Let's assume you've read these lines in one at a time into $_, using something like this:
open my $file, "<", "my.file" or die "Can't open my file: $!";
while(<$file>) {
# $_ has the current line
print if /tts\s0./;
print if /[tts30]/;
print if /^[23]/;
}
The first pattern would not print anything, because it's looking for "tts", one whitespace character immediately after the "tts" (with no intervening characters), then a zero, then any one character other than a newline.
The second would print the first and last lines, because it's looking to find one copy of either t, s, 3, or 0, anywhere in the line.
The last one would print nothing, because it wants either a 2 or 3 at the beginning (the '^') of the line.
You can try things like this in the debugger by starting it up with perl -demo, setting $_ to the line you want to match against, and then entering the print if lines, changing $_ to try the different data lines. | [reply] [d/l] |
| [reply] |
Try it and see. If the results are not what you expect, consult perlre. If you still don't understand, ask. Hint: it helps if your question doesn't look like a problem posed on a skills assessment for a job posting.
| [reply] |