in reply to Bug or Feature? Hash construct and non-value returning functions.

It's a bug in your function get_value_b. It is called in list context. Return values in list context return an empty list which is interpolated as nothing which then throws your hash initialization off. If you're going to include function return values in your hash initializations, you'd need to declare scalar context for it so you get an undef value instead.

my %args = ( 'keyA' => 'valueA', 'keyB' => scalar get_value_b(), 'keyC' => 'valueC' );

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

  • Comment on Re: Bug or Feature? Hash construct and non-value returning functions.
  • Download Code

Replies are listed 'Best First'.
Re^2: Bug or Feature? Hash construct and non-value returning functions.
by kwaping (Priest) on Dec 29, 2005 at 21:56 UTC
    Good catch! I'd give you more ++ if I could. :)