[comp.lang.perl] Perl 4.009 has at least one serious problem

marcl@ESD.3Com.COM (Marc Lavine) (06/08/91)

The script below should demonstrate a regexp problem that I found when
running Perl 4.009 on a SparcStation SLC under SunOS 4.1.  Perl was
compiled with cc.

#!/usr/local/bin/perl
#
# This script demonstrates a bug in Perl 4.009.  The regexp below should
# match the string, but it doesn't.  Removing the 'i' switch or the caret
# makes it work.
#
# Written by Marc Lavine (marcl@3com.com).
#

print ( ( "A" =~ /^A/i ) ? "okay." : "uh oh...", "\n" );
--
Marc Lavine		    	Broken: marcl%3Com.Com@sun.com
Smart: marcl@3Com.Com	    	UUCP: ...{sun|decwrl}!3Com.Com!marcl

karrer@bernina.ethz.ch (Andreas Karrer) (06/09/91)

marcl@ESD.3Com.COM (Marc Lavine) writes:

>The script below should demonstrate a regexp problem that I found when
>running Perl 4.009 on a SparcStation SLC under SunOS 4.1.  Perl was
>compiled with cc.

>print ( ( "A" =~ /^A/i ) ? "okay." : "uh oh...", "\n" );

prints "uh oh...\n" also on a Convex and on DecMipsen. Plus breaks Tom
Christiansen's "man" package, most probably because of this bug. uh oh...
looks like t/op/re_tests needs a few more lines.

+-----------
  Andi Karrer, Communication Systems, ETH Zuerich, Switzerland
  karrer@bernina.ethz.ch                 - terible simplifieur

pem@yarra-glen.aaii.oz.au (Paul E. Maisano) (06/10/91)

marcl@ESD.3Com.COM (Marc Lavine) writes:

>#!/usr/local/bin/perl
>#
># This script demonstrates a bug in Perl 4.009.  The regexp below should
># match the string, but it doesn't.  Removing the 'i' switch or the caret
># makes it work.
>#
># Written by Marc Lavine (marcl@3com.com).
>#
>print ( ( "A" =~ /^A/i ) ? "okay." : "uh oh...", "\n" );

Also the following does not work anymore
(it may or may not be related to the above):
------------
#!/usr/local/bin/perl

$x = "aa\001bb\001cc";
for (split(/\001/, $x)) { print $_, "\n"; }
------------
Under Patch Level 3 we get:
aa
bb
cc

Under Patch Level 9 we get:
aabbcc

Is /\001/ being treated as back-reference or something?

(Perl was compiled on a sun 4/60, using cc under SUNOS 4.1.1, sun's malloc)

---
Paul Maisano,
Australian Artificial Intelligence Institute