- or download this
$ perl -le'"foo" =~ /(foo)/; print $1; "bar" =~ /(bar)/; print $1;'
foo
bar
- or download this
$ perl -le'"foo" =~ /(foo)/; print $1; "bar" =~ /(bar)/; print $1; "ba
+z" =~ /(quux)/; print $1;'
foo
bar
bar
- or download this
while(<DATA>) {
if( $_ =~ /(foo)/ ) {
...
print "No match on line $..\n"
}
}