in reply to Re: dereferencing syntax question
in thread dereferencing syntax question

That would work. I would probably prefer to modify the param method and have it return a list in list context so that
my %CF = $self -> param ('CPref');
just works. But then, I don't know how 'param' is used in list context already, so it might not be feasible.

Abigail

Replies are listed 'Best First'.
Re: Re: dereferencing syntax question
by freddo411 (Chaplain) on Oct 24, 2003 at 00:38 UTC
    Thanks to BrowserUk and pg for the fix and the concise reason why.

    Abigal: param is from CGI::Application module. I'm planning to use as is and not override it.

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday

Re: Re: dereferencing syntax question
by hardburn (Abbot) on Oct 24, 2003 at 13:41 UTC

    Returning a hashref is a lot more efficient than a hash, because of all the flattening Perl does to the hash when passing one back from a subroutine. In a CGI program, a method like param() could be used a lot, so it's important to optimize it.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    :(){ :|:&};:

    Note: All code is untested, unless otherwise stated

      That's why I said I would change it to return a list in *list context*. Returning a hashref may be more efficient, but if you flatten it to a list right after returning it, you've lost most of your gain.

      Abigail