Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: C-style for loop

by LanX (Cardinal)
on Nov 15, 2008 at 21:54 UTC ( #723851=note: print w/replies, xml ) Need Help??


in reply to Re: C-style for loop
in thread C-style for loop

@cnn: your solution is almost the shortest (well,you can abbreviate foreach with for ; ). And I prefere this one!

But the OP wants to conform to the styleguides of PBP & Perl Critics, and postfix-loops are disadviced!

If I was in this situation, I would prefere

_clean_param($_) for @values;
with the routine transforming $_[0] directly, (it's an alias)

UPDATE: or

_clean_params(@values); # sub takes arr_ref by prototype

Cheers LanX

- - - - - Which song???

Replies are listed 'Best First'.
Re^3: C-style for loop
by DrHyde (Prior) on Nov 17, 2008 at 10:15 UTC
    But the OP wants to conform to the styleguides of PBP & Perl Critics, and postfix-loops are disadviced

    PBP advises against a lot of useful things. That doesn't mean that you shouldn't use them. It means that you shouldn't use them without a little bit of thought. In the right place, a C-style for loop is Just Fine. In the right place, a "postfix-loop" is Just Fine.

      You missunderstood me, it's the OP who cares about the defaults of Perl::Critics, not me! 8 )

      Cheers LanX

      - - - - - Which song???

      UPDATE: Hmm, I think my position was already quite clear, did you read the whole thread or is PBP just your equivalent to Pawlows bell? (SCNR ; )

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2021-02-28 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?