in reply to Passing named parameters to subroutines

A) Is that the actual code you're using? It doesn't generate any errors for me. And I'm using strict and -w, so that must not be your code. Although I do get an error for your use of the bareword "none"--you should quote that.

B) I usually just do something like this--load the parameters into a hash:

sub do_this_cool_function { my %params = @_; for my $k (keys %params) { print $k, " => ", $params{$k}, "\n"; } }
From glancing at its code, CGI.pm does some really fancy stuff under the hood to rearrange the named parameters. I've never found that necessary for my purposes, but it may be worth checking out if you feel the need to go advanced. :)

Replies are listed 'Best First'.
(jcwren) RE: Re: Passing named parameters to subroutines
by jcwren (Prior) on May 02, 2000 at 04:08 UTC
    Thanks! I suspected that the subroutine should pickup the parameter as a hash.

    I, uhhh, apparently had a problem in the do_cool_stuff routine that was actually causing the problem. Tired user overlooking something obvious... sigh.

    -- John