kevind0718 has asked for the wisdom of the Perl Monks concerning the following question:
Which produces:my $x; my @array; @array = qw( a b c); ($x) = qw( a b c); print $x . "\n"; $x = qw( a b c); print $x . "\n";
In this assignment: ($x) = qw( a b c); In my mind we have list to list. The list on the left only has one slot so the other two values are lost. Can some please explain what is going on here: $x = qw( a b c); and why does "c" get assigned to $x Many thanks for your kind assistance. Best KDC:\dev\learningPerl>perl ex3c.pl a c
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: scalar vs list context
by roboticus (Chancellor) on Feb 04, 2012 at 01:34 UTC | |
|
Re: scalar vs list context
by JavaFan (Canon) on Feb 04, 2012 at 08:41 UTC | |
|
Re: scalar vs list context
by Anonymous Monk on Feb 04, 2012 at 01:51 UTC | |
|
Re: scalar vs list context
by tobyink (Canon) on Feb 04, 2012 at 10:04 UTC | |
|
Re: scalar vs list context
by rustic (Monk) on Feb 04, 2012 at 11:51 UTC |