Help for this page

Select Code to Download


  1. or download this
    $ perl -wE 'my $s = "foo bar"; $s =~ /(bar)/; say ${^PREMATCH}'
    foo 
    ...
    Use of uninitialized value $^PREMATCH in say at -e line 1.
    
    $
    
  2. or download this
    $ perl -Mre=debug -wE 'my $s = "foo bar"; $s =~ /bar/;'
    Compiling REx "bar"
    ...
    Match successful!
    Freeing REx: "(bar)"
    $