Is there a simple way to unflatten @_ into a list within a subroutine?
ie:
sub mySub(%);
mySub(arg1=>'val1',arg2=>'val2',arg3=>'val3')
now i want to expand @_ back into a list.
Cheers,
Grant
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED
Grant Byers wrote:
>
> Is there a simple way to unflatten @_ into a list within a subroutine?
> ie:
>
> sub mySub(%);
> mySub(arg1=>'val1',arg2=>'val2',arg3=>'val3')
>
> now i want to expand @_ back into a list.
Did you read the perlsub document that is supplied with Perl?
perldoc perlsub
J
If you want it in hash form, as it looks from your example, just copy
it to a hash:
my %hash = @_;
On Friday, October 4, 2002, at 11:57 PM, Grant Byers wrote:
> Is there a simple way to unflatten @_ into a list within a subroutine?
> ie:
>
> sub mySub(%);
> mySub(arg1=>'val1',arg2=>'val2',arg
>= Original Message From James Edward Gray II <[EMAIL PROTECTED]>
=
>If you want it in hash form, as it looks from your example, just copy
>it to a hash:
>
>my %hash = @_;
Remember though that if you are passing anything in scalar context, like an
scalar or a reference, or more than one