in reply to subroutine list return

I don't believe Mr Muskrat's suggestion would work. You are still in a scalar context.

If you really wanted to get the count of items in the array returned, you could do it thus:

sub x{return qw/e f g h 31/}; $a= @{[x()]}; # Force array context when calling sub print $a This prints the value 5
The trick with the "@{[]}" is described in perfunc, under the function "scalar".

Replies are listed 'Best First'.
Re: Re: subroutine list return
by chromatic (Archbishop) on Jun 25, 2003 at 01:25 UTC

    Ugh. How about something a little cleaner?

    my $count = () = x(); print "$count\n";