in reply to Find partially matching line in file - print that line to another file
my code it's a bit different, but it's working ... what is the problem?
outputuse strict; my @fileone = qw/ 123456 123457 123458/; while (my $line = <DATA>) { foreach my $pattern(@fileone) { if ($line =~ /^$pattern/) {print $line."\n";} } } __DATA__ 123456 foo 123456 bar 123457 foobar 123455 this wouldn't be printed to new file
123456 foo 123456 bar 123457 foobar
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find partially matching line in file - print that line to another file
by rkmase (Novice) on Dec 14, 2007 at 15:10 UTC |