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...