On 10/25/2006 06:12 AM, Mug wrote:
Hi all,
I don't know if that anyway I can know what should I pass back
from right hand side to left hand side, like :
my $x = qw/a b c d e / ; # so I have $x = 5
my ($x) = qw / a b c d e / ; # then I have 'a'
or like
$data = <F> ; # reads 1 line from file;
@data = <F> ; # reads all line from the file
I actually want to write a piece of code like that :
my %u_info = user_detail ( $ENV{QUERY_STRING} );
# I have $u_info{id} = 'foo' , $u_info{pass} = 12345
my @attribs = user_detail ( $ENV{QUERY_STRING} );
# I have @attribs = ( 'foo', 12345 );
while I am asking %u_info , the user_detail will return a hash ,
and while I am asking @attribs, I got an array return.
Just note, I don't want to pass / ask reference.
Any pointers ? Thanks!
regards,
mug
Let your user_detail subroutine build up a hash within itself and return
that hash.
sub user_detail {
my %hash;
... stuff ...
$hash{id} = '...';
$hash{pass} = '....';
return %hash;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>