Re: string manipulation



Tad McClellan <tadmc@xxxxxxxxxxxxxx> wrote:

> James Taylor <usenet@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> > my ($dir, $leaf) = $path =~ m|^(.*)/(.*)|;
> ^
> ^
>
> That anchor serves no useful purpose, so it probably shouldn't be there.

My newsreader doesn't have a monospaced font (I must fix that) so your
caret appears to point to the dollar singin front of $path. I must
assume though that you were pointing at the beginning of line anchor in
my regex. The reason it is there is to ensure that the match fails in
linear time if there is no slash in the $path.

--
James Taylor
.