in reply to use regex match from file grep
my $last_match; if ( grep { /^tag\: (.*)$/ and $last_match = $1 and 1} <FILE> ) { print "Found tag: $last_match\n"; }
more likely you want all matches:
while (<FILE>) { next unless /^tag\: (.*)$/; print "Found tag: $1\n"; }
edit: or even
Hope this helps,print map /^tag\: (.*)$/ ? "Found tag: $1\n" : (), <FILE>;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use regex match from file grep
by rsiedl (Friar) on Jun 11, 2004 at 12:05 UTC |