in reply to Multiple strings in a file

Your code seems to work if you remove closing > when you open the file.
use 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 $_; } }
When I pass it its own filename it gives
$ 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
    I'm sorry, i accidentely put the closing brace. its not there, and unfortunately, doesn't work for me.