Text file
---------------------------------------
1234567 is alive
12345678 is not alive
123456789 is alive
Code
---------------------------------------
#! /usr/bin/perl -w
use strict;
open(FILE, ">test.txt") || die "Unable to open file: $!";
chomp (my @input = ); # 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