[comp.lang.perl] Bugs in perl 3.0 pl 8?

tytso@athena.mit.edu (Theodore Y. Ts'o) (02/11/90)

A user at my site came up with this one:  when executed as follows:

	echo foo bar | /tmp/perl.test

if you run it on a Vax, you get:

input=``foo bar''
        line=``foo bar'', quoted=``''
i_output = foo bar
        line=``foo bar'', quoted=``''
output=``''					<=== Huh?
input=``foo bar''

...and if you run it on an if you run it on an IBM RT/PC (running BSD
4.3 + Wisc. NFS) you get:

input=``foo bar''
        line=``foo bar'', quoted=``''
i_output = foo bar
        line=``foo bar'', quoted=``''
output=``foo bar''
input=``foo bar''


The program follows below:

-------
#!/mit/watchmaker/@sys/perl

sub proca {
	local($line,$quoted) = @_,"";

	return($line);
}

sub procb {
	local($line,$quoted) = @_,"";

	print "\tline=``",$line; print "'', quoted=``",$quoted,"''\n";
#	print "\tline=``",$line,"'', quoted=``",$quoted,"''\n";
	$quoted = $quoted.(do proca($line));

	return($quoted);
}

while(<>) {
	chop;
	print "input=``",$_,"''\n";
	$i = do procb($_);	
	print "i_output = $i\n";
	print "output=``",do procb($_),"''\n";
	print "input=``",$_,"''\n";
}
------

The interesting thing is that if you uncomment out the print statement, then
the output on the vax is the same as on the IBM RT/PC.  Does this look familiar
to anyone?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Theodore Ts'o				bloom-beacon!mit-athena!tytso
3 Ames St., Cambridge, MA 02139		tytso@athena.mit.edu
   Everybody's playing the game, but nobody's rules are the same!