Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

•Re: Surpised by foreach iterator limitation

by merlyn (Sage)
on Apr 08, 2003 at 04:12 UTC ( [id://248806]=note: print w/replies, xml ) Need Help??


in reply to Surpised by foreach iterator limitation

There are a few places in Perl where you have to use a "simple scalar variable". The iterator binding for a foreach loop is one. The variable of an indirect filehandle read or write is another, as is the indirect object of indirect object syntax, or the expression for which you don't need braces on a dereferencing operation.

It's a consistent notion, but not always common-sense, as evidenced by your (thankfully categorically rare) post.

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

  • Comment on •Re: Surpised by foreach iterator limitation

Replies are listed 'Best First'.
Re: •Re: Surpised by foreach iterator limitation
by shotgunefx (Parson) on Apr 08, 2003 at 04:31 UTC
    It's a consistent notion, but not always common-sense, as evidenced by your (thankfully categorically rare) post.

    I am curious about the (thankfully categorically rare) portion of your comment. The impression it leaves me with is that you think this a bad idea. While I agree it's very rare and not very useful in day to day use, it fits with the DWIM expectation which in my mind would certainly not be a bad thing.

    -Lee

    "To be civilized is to deny one's nature."
      Bah. I knew that was going to be misinterpreted, but I got lazy.

      What I'm saying is that most people don't seem to leap this direction, so we really don't see many posts wondering why it's only a simple scalar.

      I tell ya, with all the places I look, I don't see it being questioned very often.

      Maybe that's because we do a good job of describing it in the llama, so only non-llama-ites make that leap. {grin}

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

        Bah. I knew that was going to be misinterpreted, but I got lazy
        My initial impression was that it was a dig, but then I decided I wasn't sure what it meant. I agree it's a rare thing to do. I've coded Perl almost everyday single day since 98 and I just thought to try it now.

        -Lee

        "To be civilized is to deny one's nature."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found