in reply to Returning array values

This one returns an array

#return @found; # this does not return correctly.

This returns a reference to an array

#return [qw/One Two Three/]; #this will return correctly.

What you need is

return \@found;

that transforms your array into a reference, as needed by the code that calls GetUsers

Ciao, Valerio

Replies are listed 'Best First'.
Re: Re: Returning array values
by blackadder (Hermit) on Jul 29, 2002 at 10:52 UTC
    Thanks Guys indeed, the \ @found has worked.

    I also have tried getting rid of the @{} so the returned value is a single array which also worked, however I will be needing a "list of lists" later on in my script, so I need to use the \ reference.

    PS: I have read the ‘perldsc’ a number of times but I guess that I am a bit of a slow ‘Scribe’ and there were no examples on referencing on this tutorial. However, amongst your replies, I have enough articles to go on and improve my Perl techniques.

    Cheers.

      You are welcome :-)

      My way to understand Perl dsc was to Data::Dumper my structures, it is simpler if you visualize them!

      Happy coding, Valerio