Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: A simple grouping of list items

by ruzam (Curate)
on Jul 08, 2012 at 03:15 UTC ( #980537=note: print w/ replies, xml ) Need Help??


in reply to A simple grouping of list items

What the heck, just for fun, some minor code changes for faster execution.

caveat: not tested, not benchmarked, maybe not even syntactically correct, could cause different output :)

my $previous = ""; # skip $item variable # 'for' just looks funny in this use foreach (@list) { # regex once instead of twice # no extra work shuffling $previous back and forth until needed if (m/^(.+)\: .+/ and $1 ne $previous) { $previous = $1; # take the sleep hit on the first item to save time later # (maybe even 5 seconds worth if you have a lot of items) sleep(5); } print $_; }


Comment on Re: A simple grouping of list items
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://980537]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-12-29 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls