http://qs321.pair.com?node_id=84911


in reply to Dying and Swearing

Very good one! This is what I call unreadable...

You are using a propriety of die() I didn't know of...

die() can also be called with a reference argument. If this happens to be trapped within an eval(), $@ contains the reference.

So after the eval() died $@ contains a reference to an array holding only one element, which is a reference to an array containing the string "Just another Perl hacker". But what does the print() actually print?

Let's cut the all thing in several bits: first you must know that $#{@{${@}}} equals 0. Here is why: when you see $#a, this is the value of the last array index (one less than the size of the array) of the array @a. @{${@}} is an array dereference. Since $@ is an array holding only one value, the result is 0.

We now have to understand ${${${@}}[0]}[$#{${@{${@}}}[0]}]... We recognize the underlined part as an index value. Let's calculate it.

With ${${${@}}[0]}[0], we are almost there. The underlined part is an array dereference, from which we want the first element.

This element is "Just another Perl hacker". QED.