[Omaha.pm] regex questions

Jay Hannah jay at jays.net
Thu Apr 17 13:57:42 PDT 2014


>> $adj =~ s/^ $//;


On Apr 17, 2014, at 3:54 PM, Ben Howard <BHoward at neogen.com> wrote:
> I could be wrong, but since ^ matches the beginning of a line, and $ matches the end, it might be trying to remove empty lines.

It turns ' ' into ''.
 
> “Take $adj, and replace [beginning of line][end of line] with [].”

Not quite -- you needed a space in the middle there. 

> Maybe it’s one of Perl’s magic operators that sort of coerce a behavior by forcing context changes, but that’s how I read it.

No magic.

Well, Perl is *always* magic. But nothing especially so here.  ;)

j









More information about the Omaha-pm mailing list