wantarray is a misnomer -- it should be wantlist. And my response is:
if (wantarray) {
# handle scalars too!
return $self->{$x} if not ref $self->{$x};
# handle arrays
return @{ $self->{$x} } if ref $self->{$x} eq 'ARRAY';
# handle hashes
return %{ $self->{$x} } if ref $self->{$x} eq 'HASH';
# panic!
die "unknown reference type (", ref($self->{$x}), ")";
}
else { return $self->{$x} }
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??; |