Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: How many loops are there in Perl?

by tobyink (Abbot)
on Jan 31, 2012 at 08:23 UTC ( #950904=note: print w/ replies, xml ) Need Help??


in reply to Re: How many loops are there in Perl?
in thread How many loops are there in Perl?

In the spirit of your map and grep examples, here's one using sort...

perl -E'join("|", sort {do{say "Inside sort loop"} and $a <=> $b} 3,1, +2)'

Works in 5.10.1, but the Perl sorting algorithm has been known to change from version to version. Note that the join does seem to be needed to avoid Perl optimizing away the sort.


Comment on Re^2: How many loops are there in Perl?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2014-11-21 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (104 votes), past polls