Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Deleting undef values from a hash

by tilly (Archbishop)
on Dec 14, 2003 at 23:25 UTC ( #314711=note: print w/replies, xml ) Need Help??


in reply to Re: Deleting undef values from a hash
in thread Deleting undef values from a hash

I think that you'll have a hard time finding that documented. ;-) (Though I have a pretty good idea why it works.)

I also wouldn't want to trust it across Perl versions. That seems very specific to perl5, and I would not plan on that specific optimization finding its way into Ponie for instance.

  • Comment on Re: Re: Deleting undef values from a hash

Replies are listed 'Best First'.
Re: Re: Re: Deleting undef values from a hash
by ysth (Canon) on Dec 15, 2003 at 00:04 UTC
    It should be ok for perl5, though. The division of responsibilities between hv_delete_* and pp_delete pretty much require that it work. hv_delete_* will return null if the key didn't exist, which pp_delete will replace with the immortal undef value. If the key did exist, hv_delete_* will return the value (even undef) in a different sv.

    It's obviously better practice to check exists in the first place, outside of obfuscation and golf.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://314711]
help
Chatterbox?
[ambrus]: Now it has five people instead of three, some sort of call number ticket system where people wait a lot for their food to get ready (it's the same kinds of grilled meat and fish on the same equipment, it won't actually fry slower),
[ambrus]: it's slow as hell, and the food costs significantly more.
[ambrus]: We no longer eat there.
LanX Everybody quotes it, some people read it, and a few people go by it
[ambrus]: LanX: why would I read it? isn't it a book for managers? I don't want to be a manager.
[ambrus]: I don't quote it either.
[erix]: it's really a software book, albeit about experiences from the 60s-80s. People haven't changed all that much though.
[erix]: a software project book, is probably more exact
[ambrus]: Yes, but I'm not managing software teams either.
[ambrus]: I'm not only not a restaurant manager, but also not a software manager.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (16)
As of 2017-09-22 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (264 votes). Check out past polls.

    Notices?