Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^7: Unusual variable declaration

by Jenda (Abbot)
on Nov 05, 2019 at 16:33 UTC ( [id://11108331]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Unusual variable declaration
in thread Unusual variable declaration

package Foo; $Foo::y = 42; sub foo { my $x; our $y; ... } sub bar { my $x; our $y; ... }

Each of the two my $x declares a new variable. Both the our $y instruct the compiler to allow you to temporarily use a short name for the same global variable. They do NOT declare a variable!

Jenda
1984 was supposed to be a warning,
not a manual!

Replies are listed 'Best First'.
Re^8: Unusual variable declaration
by LanX (Saint) on Nov 05, 2019 at 16:45 UTC

    > > Please define "declaration"

    > They do NOT declare a variable!

    Not a definition.

    You are effectively saying reiterating again and again that my and our have differences and are using my as your personal standard for declaration.

    I'm tired of this.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2025-11-13 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (69 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.