#!/fellow/monks.pl
A collegue of mine asked me "How do you delete an entry out of an array?" I know that "delete" can zap an entry out of a hash, but what do you use to delete an entry out of an array? He went and wrote this piece of code, which does the trick pretty well.
Is there a single line perl statement, like delete that will do the same thing? My "Programming Perl" didn't reveal anything obvious.
sub delArrayEntry() { my @array1 = @_; my @array2 = ""; foreach $entry (@array1) { if ($entry ne $current_log) { push @array2,$entry } } }
Thanks!
#!/massyn.pl
You never know important a backup is until the day you need it.
In reply to Deleting an array entry by Massyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |