The -w switch seems to be unnecessary, and the -l switch seems only to assure that a newline is spit out at the end of the print. If you can do without that, and eliminate all unnecessary whitespace, you can save four more keystrokes:

perl -e'print[]+0'

The principle is this: [] creates an anonymous array reference. Evaluated in scalar context, it would appear as (for example) "ARRAY(0x155513c)." The "+0" operation causes the numeric value of the string "ARRAY(0x155513c)" to be added to zero, resulting in the non-numeric portion of "ARRAY(0x155513c)" being dropped. Finally, print automatically represents the hex number in base ten. The result (on my computer) is "22368572", which happens to be the base-10 version of the hex number "0x155513c".


Dave


In reply to Re: addresses of objects by davido
in thread addresses of objects by BioGeek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":