in reply to Passing references to array slices
The output will be '3'. You've just created a reference to an anonymous scalar value, which happened to be the last value of the list. If you had said,my $ref = \ (1, 2, 3); print ${$ref}, "\n";
Your output would be '123'. That's because the \ operator is distributive to each element in the list; and @ref receives as values three references, each to one of the anonymous scalar values in the list.my @ref = \ ( 1, 2, 3 ); print ${$_}, "\n" for @ref;
Dave
|
|---|