SPUG: minimal unmatching regex

Charles DeRykus derykus at gmail.com
Sat Aug 22 05:01:52 PDT 2009


But, $^ is assignable and, if set to the empty string,
invalidates /$^/ as a regex that won't match anything:

perl -wle '$^=''"; print "match" if "foo" =~/$^/'
match

-- 
Charles DeRykus


On Fri, Aug 21, 2009 at 11:12 PM, Michael R. Wolf <MichaelRWolf at att.net>wrote:

>
> On Aug 19, 2009, at 12:38 AM, Ingy dot Net wrote:
>
>
>>
>> On Tue, Aug 18, 2009 at 10:33 PM, Steve Sandvik <ssandv at gmail.com> wrote:
>> well, /$^/ seems like a plausible starting point.  Or ending point.
>> Or something. :-)
>>
>> Nope.
>>
>>    $^ = "";
>>    $anything =~ /$^/;
>>
>
>
> I'm missing your point.
>
> If you mean to indicate that interpolation happens inside m//, and that $^
> is an internal perlvar (with $FORMAT_TOP_NAME as a 'use English'
> equivalent), then it is *not* an empty string.  Here's the one-liner to show
> that...
>
> $ perl -le 'print $^'
> STDOUT_TOP
> $
>
> But, perhaps I missed your intent.
>
> --
> Michael R. Wolf
>    All mammals learn by playing!
>        MichaelRWolf at att.net
>
>
>
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>    POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>   MEETINGS: 3rd Tuesdays
>   WEB PAGE: http://seattleperl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20090822/096d7dd2/attachment.html>


More information about the spug-list mailing list