develooper Front page | perl.perl5.porters | Postings from August 2010

Re: mauve::reftype()

Thread Previous | Thread Next
From:
demerphq
Date:
August 30, 2010 08:04
Subject:
Re: mauve::reftype()
Message ID:
AANLkTim=7b7xoWdyWKTmAezQgpgXmYz7q0=21j6syipJ@mail.gmail.com
On 30 August 2010 17:01, demerphq <demerphq@gmail.com> wrote:
> On 30 August 2010 16:46, Zsbán Ambrus <ambrus@math.bme.hu> wrote:
>> Though I don't really understand how that works.  What do you even get
>> if you dereference a regexp with ${...}, and how can you use that
>> value?
>
> You should get a string. Its basically a special form of SCALAR.

And now i have checked...

And one does indeed get the string form of the pattern, if one dereferences.

$ ./perl -le'my $r=qr/xyz/; print $$r'
(?-xism:xyz)

basically "$qr" and $$qr are the same thing.

$ ./perl -le'my $r=qr/xyz/; print $r'
(?-xism:xyz)

Essentially a REGEXP is a special case of a blessed string.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About