in reply to Re: storing all type of vars
in thread storing all type of vars
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>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: storing all type of vars
by broquaint (Abbot) on Sep 11, 2001 at 15:29 UTC |