in reply to Subroutines and Passing data ...

dtharby,
Returning data from a sub is much like passing data to the sub. It is simple as long as they are all scalars. If you have hashes and arrays then you likely need to pass or return by reference - here is an example:
my ($scalar, $a_ref, $h_ref) = some_sub(42, \@foo, \%bar); sub some_sub { my $answer = shift; my ($foo, $bar) = @_; return ($answer, $foo, $bar); }
Let us know if that doesn't clear things up.

Cheers - L~R

Replies are listed 'Best First'.
Re^2: Subroutines and Passing data ...
by dtharby (Acolyte) on Jun 13, 2005 at 14:08 UTC
    Cheers L~R,
    That has certainly cleared it up and I have it working !!
    thanks again
      Note that when you're returning a known number of scalars and 1 single array that you won't need a reference. ie the following works just fine:
      sub foo { return($scalar, $anotherscalar, @array) } my($s1, $s2, @a) = foo;
      The array always needs to go last though...


      Remember rule one...