Help for this page

Select Code to Download


  1. or download this
    sub iregex { qr/ ... /ix }
    
    ...
        if ($isbn =~ $regex ) { print "Matched!\n }
    
    3)  if ($isbn =~ iregex() ) { print "Matched!\n }
    
  2. or download this
    > perl -we'use strict;use P;      
    my $re = qr{ (\w+) }gx;
    ...
    Bareword found where operator expected at -e line 2, near "qr/ (\w+) /
    +gx"
    syntax error at -e line 2, near "qr{ (\w+) }gx"
    Execution of -e aborted due to compilation errors.
    
  3. or download this
    > perl -we'use strict;use P;      
    my $re = qr{ (\w+) }x; 
    ...
    exit scalar(@matches);'
      output:
    #matches=4, matches=["Just", "another", "cats", "meow"]
    
  4. or download this
    perl -we'use strict;use P;      
    my $re = qr{ (?xg) (\w+) };
    ...
      output:
    Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/ (?xg
    + <-- HERE ) (\w+) / at -e line 2.
    #matches=1, matches=["another"]