Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

RE (\d+): C Style For and Foreach The Same

by turnstep (Parson)
on Aug 18, 2000 at 17:31 UTC ( [id://28476]=note: print w/replies, xml ) Need Help??


in reply to RE (tilly) 2: C Style For and Foreach The Same
in thread Finding the length of an array of arrays

Why confuse them though? I would think that telling them up front that they are the same would be easier for them in the long run. Bad enough that some perl programmers still think that they are somehow different. I never use "foreach" myself, but that's because I am exercising the first Perl Virtue. :)

  • Comment on RE (\d+): C Style For and Foreach The Same

Replies are listed 'Best First'.
RE: RE (\d+): C Style For and Foreach The Same
by tilly (Archbishop) on Aug 18, 2000 at 18:01 UTC
    What makes you think I confuse them?

    I show them the idiom as I write it and encourage them to write it the same way. If the question of whether they are the same comes up, I just say, "Yeah, they are aliases for each other, but I like to write them differently because I think it is clearer that way." I have yet to see anyone find that a huge hurdle. I have seen getting used to the different type of looping be a hurdle.

    As for telling people things up front, do you think that up front I tell people that blocks are really hashes, REs are really done by recursion, or many other minor details of the language? Perl is a big language, with many corners, and you shouldn't present it all at once.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-26 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found