how to pass a list to a subroutine?

2002-10-05 Thread Grant Byers
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

Re: how to pass a list to a subroutine?

2002-10-05 Thread John W. Krahn
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

Re: how to pass a list to a subroutine?

2002-10-05 Thread James Edward Gray II
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

RE: how to pass a list to a subroutine?

2002-10-05 Thread nkuipers
>= 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