Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^7: A wholly inadequate reply to an Anonymous Monk

by audreyt (Hermit)
on Apr 23, 2010 at 14:25 UTC ( #836531=note: print w/replies, xml ) Need Help??

in reply to Re^6: A wholly inadequate reply to an Anonymous Monk
in thread A wholly inadequate reply to an Anonymous Monk

And as for the type-based multi-dispatch case, we can observe below that Perl 5 does have the notion of runtime types:

A:~ au$ perl -MDevel::Peek -e 'Dump 3' SV = IV(0x100827190) at 0x100827198 REFCNT = 1 FLAGS = (IOK,READONLY,pIOK) IV = 3 A:~ au$ perl -MDevel::Peek -e 'Dump "3"' SV = PV(0x100801258) at 0x1008271b0 REFCNT = 1 FLAGS = (POK,READONLY,pPOK) PV = 0x100207f60 "3"\0 CUR = 1 LEN = 16

Note that the IV above refers to an integer type, and PV refers a stringish type. (cf. perlguts for details...)

As for the casting functions, Perl 5 has them built-in:

"".$x # to string 0+$x # to number int($x) # to integer

Hope that helps! :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://836531]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2017-03-30 03:28 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (353 votes). Check out past polls.