Help for this page

Select Code to Download


  1. or download this
    print substr($String, 0, 10);
    
  2. or download this
    timethese(1000000, {
      pack   => q{ my $String = 'Russ is a stud'; $String = pack("A10", $S
    +tring)},
      substr => q{ my $String = 'Russ is a stud'; $String = substr($String
    +, 0, 10)}
    });
    
  3. or download this
    Benchmark: timing 1000000 iterations of pack, substr...
          pack:  7 wallclock secs ( 7.20 usr +  0.00 sys =  7.20 CPU)
        substr:  6 wallclock secs ( 6.67 usr +  0.01 sys =  6.68 CPU)