perlquestion
mizducky
This is a homework assignment, and it works. If I use strict, I don't get an error, but if I use warnings, it says "Use of uninitialized value in string eq at line 7", it prints this error twice (I assume its for the two times that the match is found). <br>
Here is the code I am turning in for my assignment, but I still want to know why its giving me those errors, and if I should do something better. So I'm really just hoping for someone to help me understand what is happening to cause this error.
<code>
my @colors = qw(red green blue yellow pink purple brown);
my $count = @colors;
my @drop = qw(pink brown);
my $num = 0;
foreach $num (1..$count){
$num--;
if ($colors[$num] eq $drop[0] or $colors[$num] eq $drop[1]){
splice (@colors, $num, 1);
}
}
print "@colors \n";
</code>