Help for this page

Select Code to Download


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