Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: C-style for loop

by LanX (Saint)
on Nov 15, 2008 at 19:48 UTC ( [id://723838]=note: print w/replies, xml ) Need Help??


in reply to C-style for loop

"c-style" is just the name of the loop, it depends what you need...TIMTOWTDI! (*)

Anyway, with foreach-loop you shouldn't need a new array, since the iterating variable is an alias.

for $value ( @values) { $value=_clean_cgi_param($value); }

(*)UPDATE: in many cases foreach-loops are easier to maintain and less redundant than c-style. If you explicitly need to generate a *new* array, prefere map or grep.

Cheers LanX

- - - - - Which song???

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-20 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found