1 ffd9a51f 2023-08-04 jrmu #!/usr/bin/perl
2 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
4 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
5 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
6 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
7 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
8 ffd9a51f 2023-08-04 jrmu ## using this work.
9 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
11 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
12 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
13 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
14 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
15 ffd9a51f 2023-08-04 jrmu ## using this work.
16 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
18 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
19 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
20 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
21 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
22 ffd9a51f 2023-08-04 jrmu ## using this work.
23 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
25 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
26 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
27 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
28 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
29 ffd9a51f 2023-08-04 jrmu ## using this work.
30 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
32 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
33 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
34 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
35 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
36 ffd9a51f 2023-08-04 jrmu ## using this work.
37 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
39 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
40 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
41 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
42 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
43 ffd9a51f 2023-08-04 jrmu ## using this work.
44 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
46 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
47 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
48 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
49 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
50 ffd9a51f 2023-08-04 jrmu ## using this work.
51 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
53 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
54 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
55 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
56 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
57 ffd9a51f 2023-08-04 jrmu ## using this work.
58 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
60 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
61 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
62 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
63 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
64 ffd9a51f 2023-08-04 jrmu ## using this work.
65 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
67 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
68 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
69 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
70 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
71 ffd9a51f 2023-08-04 jrmu ## using this work.
72 ffd9a51f 2023-08-04 jrmu ## Copyright (C) 2023 by jrmu <jrmu@ircnow.org>
74 ffd9a51f 2023-08-04 jrmu ## Permission is granted to use, copy, modify, and/or distribute
75 ffd9a51f 2023-08-04 jrmu ## this work for any purpose with or without fee. This work is
76 ffd9a51f 2023-08-04 jrmu ## offered as-is, with absolutely no warranty whatsoever. The
77 ffd9a51f 2023-08-04 jrmu ## author is not responsible for any damages that result from
78 ffd9a51f 2023-08-04 jrmu ## using this work.
80 ffd9a51f 2023-08-04 jrmu # Make a pattern that will match three consecutive copies of whatever is
81 ffd9a51f 2023-08-04 jrmu # currently contained in $what. That is, if $what is fred, your pattern
82 ffd9a51f 2023-08-04 jrmu # should match fredfredfred. If $what is fred|barney, your pattern should
83 ffd9a51f 2023-08-04 jrmu # match fredfredbarney or barneyfredfred or barneybarneybarney or many other
84 ffd9a51f 2023-08-04 jrmu # variations. (Hint: you should set $what at the top of the pattern test
85 ffd9a51f 2023-08-04 jrmu # program with a statement like my $what = 'fred|barney';.)
87 ffd9a51f 2023-08-04 jrmu use warnings;
91 ffd9a51f 2023-08-04 jrmu my $what = "fred|barney";
93 ffd9a51f 2023-08-04 jrmu while (<>) {
95 ffd9a51f 2023-08-04 jrmu if (/($what){3}/) {
96 ffd9a51f 2023-08-04 jrmu print ("Match: $_\n");
98 ffd9a51f 2023-08-04 jrmu print ("Not matched: $_\n");