Rob Dixon wrote:
> 
> [EMAIL PROTECTED] wrote:
> > I want to delete an entry from a hash when the value becomes
> > "Finished". What is the best way of doing this?
> >
> 
> Don't forget that there is no implicit order to
> hash elements.
> 
>   foreach (keys %hash) {
>     delete $hash{$_} if $hash{$_} eq 'Finished';
>   }
> 
> will delete every element where the value is 'Finished',
> which is what you say, but I'm not sure it's what you want.

Or without the loop:   :-)

delete @hash{ grep $hash{$_} eq 'Finished', keys %hash };


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to