[comp.lang.perl] perl bug???

ling@nosun.west.sun.com (Ling Kan) (03/14/90)

Following perl fragment core dump if it is given less than 7 input parameters.
It ran OK, most of the time, with 7 or more parameters. (For example,
run "perl perl.tst 1 2 3 4 5 6 7" is OK, but "perl perl.tst 1 2 3 4 5 6" core
dump.) This is on SUN4 with SUNOS 4.0.3 and perl at patch level 14.

The perl program that the fragement was taken from was running without
any problem back in perl 2.0.

----------------------------perl.tst----------------------------------------
if ($#ARGV == -1) {
  $file = '.';
} else {
      $file = $ARGV[0];
      shift;
      while ($#ARGV > -1) {
        $file = join(' ',$file,$ARGV[0]);
        shift;
      }
}

open(LS,"/bin/ls -ld $file |");
@inputf = split(/ /,$file);
$line = 0;
while ($#inputf >= 0) {
  $file = $inputf[0];
  ($mode) =  split(/ /,$stat); 

  shift(@inputf);
}
-----------------------------perl.tst----------------------------------------