F
Frank Seitz
Hi,
given the following code:
use strict;
use warnings;
my (@a,$ref);
push @a,@$ref;
Perl throws an exception:
Can't use an undefined value as an ARRAY reference
Seems plausible.
We are modifying the code:
my (@a,$ref);
push @a,$_ for @$ref;
Now, there is no exception anymore. Perl creates the array on the fly.
Why is it so? What is the difference?
Frank
given the following code:
use strict;
use warnings;
my (@a,$ref);
push @a,@$ref;
Perl throws an exception:
Can't use an undefined value as an ARRAY reference
Seems plausible.
We are modifying the code:
my (@a,$ref);
push @a,$_ for @$ref;
Now, there is no exception anymore. Perl creates the array on the fly.
Why is it so? What is the difference?
Frank