That doesn't quite do what I expected when storing a scalar value:
use strict; { my @store; sub put { @store = ref($_[0]) ? @{$_[0]} : $_[0]; } sub get { return wantarray ? @store : \@store; } } my $scalar = 100; put($scalar); $scalar = get; print "$scalar\n";
This prints:
ARRAY(0x20026814)which means you're returning a reference when you should just be returning the value.
--Perl Training in the UK <http://www.iterative-software.com>
In reply to Re: Re: storing all type of vars
by davorg
in thread storing all type of vars
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |