Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Count the number of return values from a subroutine

by particle (Vicar)
on Jul 09, 2001 at 16:57 UTC ( [id://94959]=note: print w/replies, xml ) Need Help??


in reply to Count the number of return values from a subroutine

i'd rather get the values as well, if possible.
#!/usr/bin/perl -w use strict; $|++; use Data::Dumper; sub foo { [5, 3], 17 }; my $count = my (@values) = foo(); print $count, "\n"; print Dumper @values;
puts out:
2 $VAR1 = [ 5, 3 ]; $VAR2 = 17;
but this line: my $count = my (@values) = foo(); is ugly, usually i'd declare the variables first.

~Particle

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://94959]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found