On 21/01/2008, Adam BE <[EMAIL PROTECTED]> wrote:
> Using @$hash_ref{ @keys } I get a "@$hash_ref Not an ARRAY reference" warning 
> in Komodo
>
> however I get no warning when running the same code with use strict and use 
> warnings
> in the Perl debugger.

The best practice according to the Perl Best Practices book is to use
@{ $hash_ref }{ @keys }. (Pages 227-229).

Your code seems to be perfectly good. Maybe Komodo is silly and
doesn't know about hash slice pretending to be arrays.

Komodo is not the only tool that disregards this. Perl::Critic warns
about using %$hash_ref, but not about @$hash_ref.

(Your question reminded me of my first days of learning Perl. I
somehow figured out by myself that it makes sense that hash slices are
accessed as arrays. I don't understand why do so many people complain
the sigils...)

-- 
Amir Elisha Aharoni

English -  http://aharoni.wordpress.com
Hebrew  - http://haharoni.wordpress.com

"We're living in pieces,
 I want to live in peace." - T. Moore
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to