Help for this page

Select Code to Download


  1. or download this
    use Benchmark;
    
    ...
    
    print "tr: ";
    timethis(100000, '$var =~ tr/\\\//d');
    
  2. or download this
    s:  timethis 100000:  1 wallclock secs ( 0.51 usr +  0.00 sys =  0.51 
    +CPU) @ 195694.72/s (n=100000)
    tr: timethis 100000:  2 wallclock secs ( 1.68 usr +  0.00 sys =  1.68 
    +CPU) @ 59453.03/s (n=100000)
    
  3. or download this
    $var =~ tr /ab/cd/;
    # and
    $var =~ s /ab/cd/g;