[ale] OT: interpolation and anchors in perl regex

Brian Pitts brian at polibyte.com
Sun Oct 19 04:38:03 EDT 2008


Ed Cashin wrote:
> On Sat, Oct 18, 2008 at 6:52 PM, Brian Pitts <brian at polibyte.com> wrote:
>> Can someone explain why the last one doesn't match?
> ...
>> $ perl -e '$foo = "hello"; $bar = "hello_world"; print "yes\n" if $bar
>> =~ /^$foo_world$/;'
> 
> There's no $foo_world variable.  If you do "perl -W -e ...",
> perl will tell you that.
> 

Ah ha. I forget that I have to ask perl to warn me about things like
that. Thanks!

-Brian


More information about the Ale mailing list