in reply to RE: RE: RE: RE: Passing named parameters
in thread Passing named parameters

Sorry to reply 4 years later. The - has nothing to do with the string or bareword. The => says qoute whats on my left and pretend i'm a comma. so a(-beer=>none) is the same as a("beer", none); Perhaps this is what the original author meant but I wasn't sure and thought i might clarify a bit.


___________
Eric Hodges
  • Comment on Re: RE: RE: RE: RE: Passing named parameters

Replies are listed 'Best First'.
Re: Re: RE: RE: RE: RE: Passing named parameters
by perlmonkey (Hermit) on Apr 09, 2004 at 01:19 UTC
    I assume that "is the same as a('beer', none)" is a typo, ... and that you meant "is the same as a('-beer', 'none')"

    And since we are clarifying ... the '-' is part of the key (or the first argument, depending on how you look at it).
    bash$ perl -w -Mstrict -MData::Dumper -e \ "print Dumper( { -name => 'foo', -value => 'bar' } );"
    Results:
    $VAR1 = { '-name' => 'foo', '-value' => 'bar' };