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

Re^2: Interview Prepration

by merlyn (Sage)
on Apr 04, 2005 at 07:17 UTC ( [id://444595]=note: print w/replies, xml ) Need Help??


in reply to Re: Interview Prepration
in thread Interview Prepration

for & foreach are now an alias to each other
Uh, no. You might want to read what I wrote about Perl's "contractions", and my specific comments on "for" vs "foreach".

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^3: Interview Prepration
by cog (Parson) on Apr 04, 2005 at 09:05 UTC
    I know what you mean, you are correct, but you can write for or foreach and you will get the same result (and you say that in that link), which was what I was trying to say :-)

    It didn't even occured to me mentioning the two different types of for/foreach because I thought of the question in terms I answered it :-)

Re^3: Interview Prepration
by Anonymous Monk on Apr 04, 2005 at 07:43 UTC
    Uh, yes. The words for & foreach are an alias to each other.
      Right. They're syntax aliases, but they're semantically entirely different things. Did you read what I quoted? It explains what I mean, and I don't want to keep retyping that.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        To quote:

        They're definitely two different kinds of loops. However the text for and foreach may be used to introduce either one. The actual loop-style is determined by what follows.
        Which, seems to me, answers the question:
        What is the difference between for & foreach, exec & system
        as "for & foreach are aliases - there is no difference. They both introduce either a for-style loop or a foreach-style loop, determined by what follows."

        Methinks you're getting a bit bent out of shape over someone agreeing with you. Either that, or I'm completely missing your point.

Log In?
Username:
Password:

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

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

    No recent polls found