> > I would like to remove elements from an array that are eq to > > string '0' > > The following does not work, can someone shed some light on > > the proper > > way to do this. > > Thanks! > > Dave G. > > > > #!/usr/bin/perl -w > > > > @bag_quantity = ( '0', 1, '0', '0', '0', '0', '0', '0', '0' ); > > for (@bag_quantity){ > > shift if $_ eq '0'; > > } > > print "@bag_quantity\n";
In the spirit of TMTOWTDI (found this on usenet): for my $i (0 .. $#bq) { if ($bq[$i] eq '0') { splice @bq, $i, 1; redo; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]