SPUG: When is a caret just a caret? And what about dollar?

Tye McQueen tyemq at cpan.org
Wed Oct 14 19:46:02 PDT 2009

On Tue, Oct 13, 2009 at 7:50 PM, Yitzchak Scott-Thoennes
<sthoenna at efn.org>wrote:

> Except when in a ^-delimited regex (and not interpolated), in which case
> \^ means what ^ would otherwise have.
> Ditto re $-delimited regex.

But it would be better if \^ meant \^ (literal '^') when inside m^...^ for
the sake of making m[...] reasonable.  (Did this change?  I recall first
contemplating this due to someone advocating m[...].)

> * punctuation like $$
> > * EXCEPT the variables $(, $|, $)
> > $ that hasn't interpolated matches:

It is quite unfortunate that $] is not also an exception, at least when
inside a character class.  That is probably my least favorite feature of the
DWIM here.

You left out $foo[EXPR] and $foo{EXPR}, which may interpolate $foo
> or may interpolate a hash or array element, depending on perl's guess.

If you want to know a bit about what "guess" means there, just read the

But I'm curious of ways to force Perl's hand in either direction.  I'm also
intentionally not looking at the code myself at the moment trying to answer
my own question for reasons that I will leave unstated.  $temp= $foo[EXPR]
beforehand, of course.  $foo(?:)[EXPR].  ${foo[EXPR]}, likely. But I suspect
${foo}[EXPR] is still a DWIM case.

Oh, if you want to find the code in question, I can point the "weigh":


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20091014/afc9bfd2/attachment.html>

More information about the spug-list mailing list