Help for this page

Select Code to Download


  1. or download this
    # Compiles each pattern once since m// realises
    # you're using the same pattern twice in a row.
    ...
          /$re/
       }
    }
    
  2. or download this
    # Compiles each pattern twice
    for (1..2) {
    ...
          /$re/
       }
    }
    
  3. or download this
    # Compiles each pattern once
    my @res = map qr/$_/, qw( foo bar );
    ...
          /$re/
       }
    }
    
  4. or download this
    # Doesn't recompile $re if it's a qr//.
    /$re/
    ...
    # Stringifies and recompiles $re if it's a qr//,
    # but it should be subject to the caching mentioned above.
    /x$re/