in reply to Optimize my foreach loop / code

Hi, how fast does this run you

sub ff{print scalar gmtime, "\n"; } ff; @g=(1..35_000); for(@g){ /(\d+)/ and $ff{$1}=$1; /(\d+?)/ and $ff{$1}=$1; /(\d+)/ and $ff{$1}=$1; /(\d+?)/ and $ff{$1}=$1; } ff; __END__

Replies are listed 'Best First'.
Re^2: Optimize my foreach loop / code
by rmocster (Novice) on Aug 25, 2016 at 20:31 UTC

    Less than 1 second.

    Thu Aug 25 20:29:05 2016
    Thu Aug 25 20:29:06 2016