Hope this helps!! -EricText file --------------------------------------- 1234567 is alive 12345678 is not alive 123456789 is alive<br><br> Code --------------------------------------- #! /usr/bin/perl -w use strict; open(FILE, ">test.txt") || die "Unable to open file: $!"; chomp (my @input = <FILE>); # store lines in array, removing CRLF close(FILE); foreach my $line (@input) { if($line =~ m/is alive/) { print "$line\n"; } } Output ------------------------------------- 1234567 is alive 123456789 is alive
In reply to Re: Printing matched lines
by emilford
in thread Printing matched lines
by zuinc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |