in reply to Miniature golf question

Another WTDI:
my %newhash = %hash; delete @newhash{grep !/^t/, keys %newhash};
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: Re: Miniature golf question
by suaveant (Parson) on Jul 16, 2001 at 23:02 UTC
    Golfed this is way shorter than mine... though my technique could be used in other places, this one is a much lower par for this hole :)

    Update heres a sneaky golf trick, tho...

    delete@h{grep!/^t/,%h};
    You don't need the keys... sure it will look at the values, but it will only try to delete the values as keys if they start with a t, and they should be deleted anyway, and if it doesn't have a key that matches it, it ignores it... save 4 strokes... woohoo

                    - Ant