Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: A simple grouping of list items

by ruzam (Curate)
on Jul 08, 2012 at 03:15 UTC ( [id://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 $_; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2024-04-25 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found