in reply to Re: While loop and LAST
in thread While loop and LAST
Hm. If the hash is of any size, that is a much slower and more memory hungry approach to solving the problem than simply using keys %job_categories; within the outer loop to reset the iterator:
$h{ $_ } = $_ for 0 .. 1e6;; cmpthese 1,{ a=>q[ while( ( $k, $v ) = each %h ){ my $x = "$k:$v"; } ], b=>q[ for my $k ( keys %h ){ my $x = "$k:$h{$k}"; } ], };; s/iter b a b 8.67 -- -83% a 1.52 472% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: While loop and LAST
by Kenosis (Priest) on Nov 02, 2013 at 07:25 UTC | |
|
Re^3: While loop and LAST
by mcoblentz (Scribe) on Nov 02, 2013 at 16:29 UTC | |
by BrowserUk (Patriarch) on Nov 02, 2013 at 17:08 UTC | |
by mcoblentz (Scribe) on Nov 02, 2013 at 18:39 UTC |