Question:

If I have an array and want to take the first element off and return it, I
would do it like this:

   return (@myArray) ? shift(@myArray) : undef;

How would I do similarly with a hash?  I have something like this:


   return (exists $myHash{$val1} ) ? $Hash{$val2} : undef;

But these leaves the value in the hash.  I know I can save the value first,
then DELETE it, and then return it.  But I'd like to do it all in one step.

TIA

-Jeff

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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

Reply via email to