Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: seeking different ways to slice a 2-d array

by Fletch (Bishop)
on Apr 25, 2002 at 02:18 UTC ( #161837=note: print w/replies, xml ) Need Help??

in reply to seeking different ways to slice a 2-d array

ITYM `lexically scoped variable', not transitory. And you're probably thinking of mjd's Coping with Scoping.

  • Comment on Re: seeking different ways to slice a 2-d array

Replies are listed 'Best First'.
Re: Re: seeking different ways to slice a 2-d array
by belden (Friar) on Apr 25, 2002 at 16:58 UTC
    As I learn more about Perl and programming in general, I find myself re-reading articles and saying, "Ohhh.... so that's what it means...". Case in point: Coping with Scoping. Thanks for the pointer.

    Dropping off to sleep last night I realized that the article I was thinking of was a Red Flags article on The actual term mjd used was synthetic variables although in a different Red Flags article he talks about synthetic code

    setenv EXINIT 'set noai ts=2'

Re: Re: seeking different ways to slice a 2-d array
by samtregar (Abbot) on Apr 25, 2002 at 08:06 UTC
    I'd like to read that again when it's updated to describe 'our'. I use 'our' all the time but the cross-over between the previously totally unrelated realms of lexical and package variables is still a bit vague in my mind.


      I am very curious to know why you use our so much. I have never had a reason to use it myself because i tend to use OO a lot.

      I recently had a big revelation at (jeffa) 3Re: Whether to use local(), hopefully this post will remove the vagueness from your mind as well.

      Oh $#!^ - you are Sam Tregar. Scratch that last sentance! :O


      (the triplet paradiddle with high-hat)
        I use it any time I would have used "use vars" in the past - to access package globals. The nice thing is that I can scope where that access is legal. So, if I've got a package global %CACHE and two routines read_cache and write_cache I can:
        sub read_cache { our %CACHE; ... } sub write_cache { our %CACHE; ... }
        And they'll access the same variable. But if I start refering to %CACHE inside some other routine I get an error just like if %CACHE had been a lexical. I like that.

        So, I guess I'm pretty happy with our. The only reason I want more education is that I learned about lexical and package variables as totally separate!!! and now they ain't... Which is cool, but also pretty bizarre.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2023-02-06 13:38 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (34 votes). Check out past polls.