Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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! :-)


Comment on Re^7: A wholly inadequate reply to an Anonymous Monk
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://836531]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2015-07-29 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls