Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: C-style for loop

by LanX (Cardinal)
on Nov 15, 2008 at 19:48 UTC ( #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
Node Status?
node history
Node Type: note [id://723838]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2021-02-28 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?