Re: string manipulation
- From: usenet@xxxxxxxxxxxxxxxxxxxxxxxxxxx (James Taylor)
- Date: Sat, 28 Jan 2006 17:01:31 +0000
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.