Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: What are all the Perl data types?

by blazar (Canon)
on May 24, 2007 at 20:27 UTC ( [id://617332]=note: print w/replies, xml ) Need Help??


in reply to Re: What are all the Perl data types?
in thread What are all the Perl data types?

I know $regex is a scalar, but the thing it refers to should be considered another type (which ref calls "Regexp").

(Sorry for replying so late!) Indeed the return value of qr is a blessed reference. Thus these "objects" are real objects, and turn out to be autoboxed:

use YAPE::Regex::Explain; sub Regexp::explain { print YAPE::Regex::Explain->new(shift)->explain; } qr/^.*?Foo(Bar){3,7}\d+/->explain;

In Perl 6 everything is an object too, but currently this is not the case for simple scalars, arrays, etc. unless you use the very interesting autobox module, which used to require a patch, but doesn't anymore, last I checked.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-25 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found