Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2016-02-09 12:29 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (313 votes), past polls