Because you are then passing the array @fred to the function print as an argument list; the array is evaluated in list context and yields its individual elements.
Update: E.g.:
See @_ in perlvar.c:\@Work\Perl>perl -wMstrict -e "sub foo { print $_[1]; print qq{\n}; ;; my @copy_of_arguments = @_; print $copy_of_arguments[1]; print qq{\n}; } ;; my @ra = qw(one two three); foo(@ra); ;; foo('four', 'five', 'six'); " two two five five
In reply to Re^3: Strange behaviour with Arrays and print?
by AnomalousMonk
in thread Strange behaviour with Arrays and print?
by pingufreak83
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |