[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] OT: interpolation and anchors in perl regex



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