in reply to Re^2: passing a hash to module function
in thread passing a hash to module function

ok so how do I fix it? I dont know how to pass it properly... I am okey just passing it somehow. I want to have a hash passed to that funtion
  • Comment on Re^3: passing a hash to module function

Replies are listed 'Best First'.
Re^4: passing a hash to module function
by Marshall (Canon) on Feb 15, 2011 at 19:27 UTC
    When you pass a hash to a function, this "flattens out" as a sequence of key, value. No need to worry, follow the below formula:

    ### Create a new multipart message: $msg = MIME::Lite->new ( From => 'me@myhost.com', To => 'you@yourhost.com', Cc => 'some@other.com, some@more.com', Subject => 'A message with 2 parts...', Type => 'multipart/mixed' ); ### use Net:SMTP to do the sending $msg->send('smtp','some.host', Debug=>1 ); Same as: $msg->send('smtp' => 'some.host', 'Debug' => 1 );
    you were passing a reference to a hash instead of the actual hash which is key value pairs.

    Update: Ooops. What Wind has written is correct. I missed that you were passing a hash ref to a very, very thin layer. My bad.