For those that wonder how the heck you even can dereference a qr// object: I'm sorry, I don't know either. :)

But this below is usually how I go about when I find an unexpected behaviour of this kind. I perhaps won't get all the whys, but I might get an explanation that works for me and that will add another piece to the puzzle.

I do believe that perl interally treats a qr// as a blessed scalar, being blessed into class Regexp. The object itself is as magical as objects get I think, and we can't get any useful info out of just printing the object as you usually can, but overload can help us out:
use overload; print overload::StrVal(qr/asdf/); # Regexp=SCALAR(...)
And Devel::Peek help us in another way:
use Devel::Peek; Dump(qr/asdf/);
yielding:
SV = RV(0x1af1fd8) at 0x1b0f118 REFCNT = 1 FLAGS = (PADBUSY,PADMY,ROK) RV = 0x1b0f190 SV = PVMG(0x1c2c5ac) at 0x1b0f190 REFCNT = 1 FLAGS = (OBJECT,RMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x1af012c MG_VIRTUAL = 0x2808c138 MG_TYPE = 'r' MG_OBJ = 0x1b0b51c STASH = 0x1de7570 "Regexp"
showing us that regexes are magical. I don't see it being defined anywhere. But I have no idea why this is the case. But I can't say I'd expect a sane dereference value for a magical object. :) In fact, thinking about it I'd more expect undef than anything else because... the value isn't defined since it's not actually a scalar, and what would be a good substitute value anyway?

Hoped this helped in some way,
ihb

In reply to Re: Undefined regexp objects? by ihb
in thread Undefined regexp objects? by diotalevi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.