Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: non-global $/

by Ultra (Hermit)
on Jun 22, 2005 at 13:49 UTC ( [id://469018]=note: print w/replies, xml ) Need Help??


in reply to non-global $/

I expected that $/ would be package specific, it doesnt seem to be,

That's what my does.

local has a good explanation here: Variable Scoping in Perl: the basics

Dodge This!

Replies are listed 'Best First'.
Re^2: non-global $/
by Jenda (Abbot) on Jun 22, 2005 at 15:33 UTC

    Nope. my() doesn't care about packages.

    use strict; my $x = 5; print "\$x in main package=$x\n"; package other; print "\$x in other package=$x\n";

    Jenda
    XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented.

      Indeed, but in his context, my would be more suited.

      Update: Thanks monkey_boy for pointing me that Can't use global $/ in "my"
      Dodge This!

        my $/ = 'Foo';

        Wont compile:
        Can't use global $/ in "my"


        This is not a Signature...

Log In?
Username:
Password:

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

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

    No recent polls found