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 monsoon (Pilgrim)
on Jul 08, 2012 at 01:38 UTC ( #980536=note: print w/ replies, xml ) Need Help??


in reply to A simple grouping of list items

Just for fun, golfing...

"" =~ /()/; for (@list) { sleep(5) if !/^$1/; print; /^(.+)\:/; }
By the way the original script wasn't working if the items were ending with \n, because \n wasn't being replaced and $item was never matching $previous on the next iteration. However, if there were no \n characters, I had to set $| to non zero to get the expected behavior, otherwise output was getting buffered and was printed in one chunk at the very end.


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://980536]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2014-08-01 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (27 votes), past polls