[EMAIL PROTECTED] wrote:
> Hello,
> 
> How does one update a hash element in PERL?
> 
> I am using anonymous hashes to process a file, and each element in the
> anonymous has its own value...
> 
> If the file has success on process, I delete the hash element from the
> anonymous hash...
> 
> If it the file fails to process, I need to increment the attempts to
> the next higher number...
> 
> I tried this,
> 
> If ($HASH{KEY}->{attempts} != '5') {
> 
>       $attempted = $HASH{KEY}->{attempts} + '1';
> 
>       $HASH{KEY}->{attempts} => $attempted; #Update the hash key

        If ( ++$HASH{KEY}->{attempts} > 5) {
                move file to error folder
          }
        Uncertain yuor format here, but if attempts is what is controlling your 
error processing, then should be able do what is in the above.

Wags
> 
> } else {
> 
>       Move the file to the error folder...
> 
> }
> 
> When I run it, I get "Useless use of hash element in void context.
> Useless use of private variable in void context...
> 
> How could this better be written?
> 
> -Dan
> 
> _______________________________________________
> ActivePerl mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to