NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Another gotcha for you (Score:1)
$ perl -wle 'package foo; our $_; print map {$_} 1..5'
Use of uninitialized value in print at -e line 1.
Use of uninitialized value in print at -e line 1.
Use of uninitialized value in print at -e line 1.
Use of uninitialized value in print at -e line 1.
Use of uninitialized value in print at -e line 1.
What happened? Well $_ is supposed to be $main::_. But after the our, $_ is now looking at $foo::_ while map still populates $main::_.
You may find http://www.perlmonks.org/?node_id=48379 [perlmonks.org] to be of interest as wel
Sooo.... (Score:1)
Re: (Score:1)
File-scoped
ourvariables could be a problem. Block-scopedourvariables are less troublesome.Yet another gotcha (Score:1)
Another small problem with
ourvariables is that they take twice the memory of lexical variables or plain global.Close the world. txEn eht nepO
Re: (Score:1)
ourvariable it's not suddenly going to consume 2000 bytes. It would be more accurate to say they take twice the overhead.Lexical alias (Score:2)