http://qs321.pair.com?node_id=851857


in reply to return more than 1 value

changma_ha:

Like so:

Roboticus@Roboticus-PC ~ $ cat ret.pl #!/usr/bin/perl my ($x, $y) = foo(); print "x=$x, y=$y\n"; sub foo { return 3, 5 } Roboticus@Roboticus-PC ~ $ perl ret.pl x=3, y=5

You simply return a list of values. You can't use two successive return statements, because after the first one, the second will never execute.

...roboticus