in reply to Re: Matching against list of patterns
in thread Matching against list of patterns
To get the matched pattern matched text you can simply do:
But be carefull if you want to get another matched text in this line. Somewhat it eats up all $1,$2,$3. Use $+ to get the last matched text of the line.my $pattern = join '|', map "($_)", @patterns; ... if ($line =~ /($pattern)/i) { print "matched $1\n"; }
Schuk
Edit: Sorry HV I should learn to read more carefully.
In Section
Seekers of Perl Wisdom