http://www.perlmonks.org?node_id=991682


in reply to Regarding Initialization and Use of Hashes

Always check your sigils!

--linuxkid


imrunningoutofideas.co.cc
  • Comment on Re: Regarding Initialization and Use of Hashes

Replies are listed 'Best First'.
Re^2: Regarding Initialization and Use of Hashes
by CountZero (Bishop) on Sep 05, 2012 at 08:13 UTC
    Even more important, check your brackets!

    • $variable[1] returns an array element
    • $variable{'one'} returns a hash value
    Both are of course scalars as indicated by the $ sigil.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics