in reply to addresses of objects
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: addresses of objects
by Jenda (Abbot) on Aug 09, 2004 at 17:02 UTC | |
|
Re^2: addresses of objects
by tinita (Parson) on Aug 11, 2004 at 10:05 UTC | |
by davido (Cardinal) on Aug 11, 2004 at 15:43 UTC | |
by tinita (Parson) on Aug 11, 2004 at 16:28 UTC |