[Kc] infix pointer question

Eric Wilhelm scratchcomputing at gmail.com
Thu Aug 31 16:02:30 PDT 2006


# from David Nicol
# on Thursday 31 August 2006 02:59 pm:

># perl -wle 'sub f(){print "called f"}; $h{ f() } = 4; print keys %h'
>called f
>1

Another way to call it (or, more commonly, you want the value of a
constant -- but we should be using Readonly now, right?), put a 
unary + before it.

$ perl -wle 'sub f(){print "called f"; "thbbt" }; $h{+f} = 4; print keys %h'
called f
thbbt

--Eric
-- 
The opinions expressed in this e-mail were randomly generated by
the computer and do not necessarily reflect the views of its owner.
--Management
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the kc mailing list