develooper Front page | perl.perl5.porters | Postings from March 2000

'use vars' incompatibility!

Thread Next
From:
Unknown Sender
Date:
March 5, 2000 01:40
Subject:
'use vars' incompatibility!
Message ID:
20000305104013.A4298@noris.de
$ eperl -w -e '
   use strict;
   use vars '$foo';
   BEGIN {
      $some::var="bar";
      *foo = \$some::var;
   }
   print "$foo\n";
'
Variable "$foo" is not imported at -e line 8.
Global symbol "$foo" requires explicit package name at -e line 8.
Execution of -e aborted due to compilation errors.

Replacing "use vars" with the equivalent "our" works and prints "bar".
So did the above code in 5.005_03.

-- 
Matthias Urlichs  |  noris network GmbH   |   smurf@noris.de  |  ICQ: 20193661
The quote was selected randomly. Really.    |      http://www.noris.de/~smurf/
-- 
The ends justify the means.
               --after Matthew Prior

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About