Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- hash as argument
Re: hash as argument
> X-Ftn-To: Aaron DeLoach
> >I am trying to call a sub with two arguments. One being a hash generated
> >from a sub, the other being a string. I've tried other variations but can
> >only get the receiving sub to recognize either the hash or the string,
> >never both.
> >e.g, &do_something(&create_hash, "This is the string.");
> >sub do_something
> > my (%hash, $string) = @_;
> > process...
> >sub create_hash
> > my %h;
> > # construct the hash ...
> > return %h;
> >Can anyone get me in the right direction?
> my ($string, %hash) = @_;
> this is for the same reason you can't
> my (@arr, $string) = @_;
> as @arr gets all arguments from @_