wsanders has asked for the wisdom of the Perl Monks concerning the following question:
which prints$uptime=`cat /proc/uptime`; print ref(\$uptime)," $uptime\n"; $uptime*=1; print ref(\$uptime)," $uptime\n";
It's not really a dereference is it? This is perl 5.10-comes-with-CentOS, so the * dereference operator had not been invented yet. Or is this a variation on *foo{THING}? Even more odd:SCALAR 12844.72 24452.05 SCALAR 12844.72
Returns$uptime=`cat /proc/uptime`; print ref(\$uptime)," $uptime\n"; $uptime*=2; print ref(\$uptime)," $uptime\n";
No idea where that second value of $uptime comes from ... I would do this with a regular expression myself, much more obvious ... Thanks in advance, wSCALAR 12956.65 24667.72 SCALAR 25913.3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What is the * postfix operator, pre-'feature postderef'?
by roboticus (Chancellor) on Sep 10, 2014 at 20:40 UTC | |
by wsanders (Novice) on Sep 10, 2014 at 20:56 UTC | |
by GrandFather (Saint) on Sep 10, 2014 at 21:28 UTC |