Hi all,
Hello,
Can you please tell me what's the difference between these two types of getting the reference to @a array?
my $ref = [ @a ];
This copies the array to an anonymous array and returns a reference to that anonymous array. It is equivalent to:
my $ref = do { my @temp = @a; [EMAIL PROTECTED] };
and my $ref = [EMAIL PROTECTED];
This returns a reference to the array.
If I do: use Data::Dumper; print Dumper $ref;
Both ways of accesing the @a array with a reference seems to be the same, because Data::Dumper prints the same thing for $ref.
I need to access an array reference in a module, like...
my $self = [ @a ]; or... my $self = [EMAIL PROTECTED];
and I don't know if there will be any differences...
It depends on the scope of @a.
John -- use Perl; program fulfillment
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>