Hi All,
I was told that I shouldn't use the C format of using for (i.e. for ($i=0;$i<10;$i++) for replacing the array's elements but use perl's for/foreach command. That works fine but I need to remove some cells/elements from an array, how do it using for/foreach?
my current code is like this:
foreach my $i (@a) { foreach my $j (@b) { if ($i eq $j) { undef $i; undef $j; last; } } }
I can't use delete and undef just removes the contents leaving my array with lots of empty 'spaces'. How can I remove the array's cell totally and not just the contents?
Thanks.
Desmond
In reply to Removing array elements by sandrider
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |