in reply to Autovivification of scalars in sub calls
Incidentally, you can also induce lvalue context by taking a reference. Interestingly, this program generates a warning about Useless use of reference constructor, but without taking the reference, it dies on the undefined value.
It should go without saying that using these side-effects to initialize is not a good programming practice.use warnings; use strict; my $x; \@$x; print @$x;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Autovivification of scalars in sub calls
by tlm (Prior) on Dec 08, 2005 at 18:34 UTC | |
by Roy Johnson (Monsignor) on Dec 08, 2005 at 18:47 UTC | |
by Anonymous Monk on Dec 08, 2005 at 22:01 UTC | |
by truedfx (Monk) on Dec 09, 2005 at 11:51 UTC | |
by Perl Mouse (Chaplain) on Dec 08, 2005 at 23:02 UTC | |
|
Re^2: Autovivification of scalars in sub calls
by ambrus (Abbot) on Mar 23, 2007 at 14:31 UTC |