in reply to Re: Skip return values
in thread Skip return values

And, if returning an array reference, yet another way:
>perl -wMstrict -le "sub sample { return [1, 2, 3, 4]; } my $c = sample()->[2]; print $c; " 3
BTW: The  &sample form of subroutine invocation is deprecated.

Replies are listed 'Best First'.
Re^3: Skip return values
by codeacrobat (Chaplain) on Apr 03, 2009 at 14:22 UTC
    You are passing @ARGV to sample. Thats why the syntax &subroutine is bad TM. Its not just cosmetically ugly.

    print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});