|Perl Monk, Perl Meditation|
Passing named parametersby jcwren (Prior)
|on May 02, 2000 at 03:54 UTC||Need Help??|
jcwren has asked for the
wisdom of the Perl Monks concerning the following question:
I am off on a jobsite without my trusty Perl CD Bookshelf.
I need(want) to pass named parameters to a subroutine, ala CGI..
do_this_cool_function (-retire=>'early', -payscale=>-55.00, -pizza=>'cold', -beer=>none);
I'm using 'use strict' and '-w'. The compiler throws up on my shoes with
"Can't use string ("-spot") as a HASH ref while "strict refs" in use at t.pl line 13."
A) What do I need to do remove this error,
B) How do I access the named arguments in the subroutine?.