[comp.lang.perl] strange regexp match

utashiro@sran84.sra.co.jp (Kazumasa Utashiro) (09/28/90)

I have a strange regexp match behavior.  Try this script.

------------------------------------------------------------
#!/usr/local/bin/perl

$_="xx.o:\t         U xxxxx";

case1: do m('^(.*):\t([0-9a-f ]{8}) (\w) (.*)');

$_="xx.o:\t00000000 T xxxxx";

case2: do m('^(.*):\t([0-9a-f ]{8}) (\w) (.*)');
case3: do m('^(.*.):\t([0-9a-f ]{8}) (\w) (.*)');
#                !
case4: do m('^(.*):\t?([0-9a-f ]{8}) (\w) (.*)');
#                    !
sub m {
	printf "%d: ", ++$i;
	print /$_[0]/ ? $& : "not matched", "\n";
}
__END__
------------------------------------------------------------
I've got following result from perl@28 on some machines.

1: xx.o:	         U xxxxx
2: not matched
3: xx.o:	00000000 T xxxxx
4: xx.o:	00000000 T xxxxx

Using + instead of * makes no difference.  Am I missing
something?

---
K. Utashiro
utashiro@sra.co.jp