Help for this page

Select Code to Download


  1. or download this
    my $fractionValue =
        ( $str =~ m{^(\d+)/([1-9]\d*)} )   # regex match will evaluate to 
    +true or false
    ...
        :            # otherwise (if above condition was false), ...
        "undefined"  #   return this value
        ;            # end of statement
    
  2. or download this
    /blah/
    m/blah/
    m=blah=
    m!blah!
    m{blah}
    
  3. or download this
    /http:\/\/my\/path\/to\/insanity/
    m{my/path/back/to/sanity}
    
  4. or download this
    $_ = "123.456/789-0";
    if ( /(\d+)\D(\d+)\D(\d+)/ ) {
        printf( "Found three numbers: %d was between %d and %d\n", $2, $1,
    + $3 );
    }
    
  5. or download this
    if ( $_ =~ /(\d+)\D(\d+)\D(\d+)/ ) { ...