in reply to Re: Creating Variables Just to Pass into Subroutine? (named arguments)
in thread Creating Variables Just to Pass into Subroutine?

Thanks for the input, yes this code is going on about 15 years old at the least... I have a question about the way the arguments are being passed, it looks a lot like hash notation found in perl so I'm confused about how the arguments get interpreted on the subroutine side. Does this implementation require a change in the subroutine itself or will it still be able to read the same arguments that are passed in, meaning that this is only a change to the way the subroutine is called?
  • Comment on Re^2: Creating Variables Just to Pass into Subroutine? (named arguments)

Replies are listed 'Best First'.
Re^3: Creating Variables Just to Pass into Subroutine? (named arguments)
by LanX (Saint) on Jul 23, 2015 at 19:10 UTC
    I know it's confusing but => is not a hash notation (ie not exclusively) like : in JS or python.

    it's just a list separator, see "fat comma". I.e. you are passing a list.

    There are two ways to pass hashes , either as a flat list and you have to copy @_ later to a %arg hash. (See example link)

    or as a anonymous hash in curlies and you have to read the hash ref from $_[n] (see my other post)

    HTH ! =)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!