in reply to Re^5: the "our" declaration ?!!
in thread the "our" declaration ?!!

with curlies, no nesting:
use strict; no warnings; #no strict "vars"; # option1 our $x; # option2 { package one; $x="one"; print $x; } { package two; print $x; } __END__ 1: one 2: oneone
I know that "use warnings" produces to "Use of uninitialized value" for option 1, but that's not the point here.

Cheers Rolf

Replies are listed 'Best First'.
Re^7: the "our" declaration ?!!
by ikegami (Patriarch) on Jan 20, 2009 at 22:51 UTC
    You're forgetting about main, where the our is located
      But we are talking about refactoring "no strict vars" into "our", IMHO most people would place "no strict vars" into the top scope, if there are multiple packages...

      your rule of a thumb is over-simplified, and is not getting better with additional side-rules for curlies and forbidden nesting...

        Having to counter "It doesn't work if I do something else I shouldn't" is not adding rules or over simplifying. Since proper encapsulation is the basis of programming, I didn't add any rules.