Re: sending scalar and hash to function

2011-06-27 Thread Shaun Fryer
In the first code snippit, your function will receive a hash reference, which is a scalar. If you get rid of the curly braces, it will work. Better still would be my ($myopt, $myparams) =@_; ...and... each %$myparams -- Shaun Fryer 1-647-723-2729 On Jun 27, 2011 2:33 PM, wrote: > I am tryi

Re: sending scalar and hash to function [SUMMARY]

2011-06-27 Thread Mike Williams
On Mon, Jun 27, 2011 at 2:44 PM, wrote: > > Found the solution (my apologies). > > I am receiving both an scalar, the second one as a reference, then it must > be assigned to an other var. > > No. It does not have to be assigned to another var. Instead you should dereference the reference. su

sending scalar and hash to function [SUMMARY]

2011-06-27 Thread buzon
Found the solution (my apologies). I am receiving both an scalar, the second one as a reference, then it must be assigned to an other var. sub dosomething { ($myopt,$myparams) = @_; %myparams = $myparams; print "opt = $myopt\n"; while( my ($k, $v) = each %myparams )

sending scalar and hash to function (note)

2011-06-27 Thread buzon
of course that is sub dosomething but still not working. -- To unsubscribe, e-mail: beginners-cgi-unsubscr...@perl.org For additional commands, e-mail: beginners-cgi-h...@perl.org http://learn.perl.org/

sending scalar and hash to function

2011-06-27 Thread buzon
I am trying to send an scalar and hash to a function, but is not receiving the value of the hash My code is: dosomething('option',{'extraparam1'=>'hello'}); function dosomething { ($myopt,%myparams) = @_; print "opt = $myopt\n"; while( my ($k, $v) = each %myparams )