foreach (@pwds) { $i++; next unless $_ =~ m/$grep/; $_ =~ m/(.*?) - (.*?) \((.*?)\)/; print "Delete '$1'? [y/n] "; chop(my $command = <STDIN>); next unless $command eq 'y'; splice(@pwds, $i, 1); }
From the "Foreach Loops" section of perlsyn:
If any part of LIST is an array, "foreach" will get very confused if you add or remove elements within the loop body, for example with "splice". So don't do that.
In reply to Re: Password Manager
by jwkrahn
in thread Password Manager
by alexbio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |