in reply to Multiple strings in a file
When I pass it its own filename it givesuse strict; use warnings; my ($textFile, $firstString, $secondString) = @ARGV; open my $text, "<$textFile" or die "Dead"; while(<$text>){ if(/$firstString/m){ print $_; } if(/$secondString/m){ print $_; } }
$ perl foo.pl foo.pl first second my ($textFile, $firstString, $secondString) = @ARGV; my ($textFile, $firstString, $secondString) = @ARGV; if(/$firstString/m){ if(/$secondString/m){
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multiple strings in a file
by The_Last_Monk (Novice) on Feb 10, 2015 at 17:59 UTC | |
by BillKSmith (Monsignor) on Feb 10, 2015 at 18:56 UTC |