in reply to list returned from function

The preceding answers assume that MyFunc() returns an array. If it returns an array reference, as it might, you need
sub MyFunc { my @ary = qw(a b c d e f g h i j); return \@ary; } my $foo = ${MyFunc()}[4];


§ George Sherston

Replies are listed 'Best First'.
Re: Re: list returned from function
by PrakashK (Pilgrim) on Jan 18, 2002 at 03:34 UTC
    Nothing wrong with the above. But I prefer:
    my $foo = (MyFunc())->[4];
    /prakash