Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^4: Adding hashes to already existing array

by ExReg (Priest)
on May 11, 2016 at 14:11 UTC ( #1162765=note: print w/replies, xml ) Need Help??

in reply to Re^3: Adding hashes to already existing array
in thread Adding hashes to already existing array

The syntax "$%{$excerpts[$i]}{fpart}" is probably not doing what you want - it's populating a hash "%%"!

Thank you for the bit about it actually being the hash %%. I thought I knew references well enough and now I guess I didn't. I have been re-reading the books and docs on references for the last few days and hope to never again utter such execrable desecrations.

Replies are listed 'Best First'.
Re^5: Adding hashes to already existing array
by haukex (Chancellor) on May 12, 2016 at 10:03 UTC

    Hi ExReg,

    You may want to have a look at perlcritic, which can be helpful in catching some potential issues in addition to strict and warnings. For example, in this case it would have issued a warning 'Magic variable "$%" should be assigned as "local"' in regards to the %% hash (its analysis is not perfect but in this case at least it gives a hint), and a warning 'Capture variable used outside conditional', which stevieb already correctly pointed out. If you run perlcritic --verbose 10 ..., you will get a brief explanation of the issue as well. perlreftut and perlref are also good sources of information on references.

    Hope this helps,
    -- Hauke D

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1162765]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2019-10-21 21:13 GMT
Find Nodes?
    Voting Booth?