[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Re: HUMOR: you have to see this code!



On Mon, Nov 08, 1999 at 09:44:27AM -0500, John Porter wrote:
> Charles H wrote:
> > Yes, it's weird, and yes it's almost funny. But it probably does what he wanted it to
> > do...
> 
> Bet it doesn't.
> 
> sub get_numeric_keys_greater_than_passed_value($;\%){
>         if(!$_[1]){
>         local ($val) = @_;
>         local (@temp) = grep{($_ > $val)} keys (%LADY_TABLE);
>         }
>         else{
>         local ($val,*TABLE) = @_;
>         local (@temp) = grep{($_ > $val)} keys (%TABLE);
>         }
>         return (*temp);
> }
> 
> What the hell does this return?  What happened to the
> keys that were so carefully grepped?

Its pass by glob, a perl4-ism used before references were introduced.
return *temp; is the functional equivalent of return \@temp; (kinda).

-- 

Michael G Schwern                                           schwern@pobox.com
                    http://www.pobox.com/~schwern
     /(?:(?:(1)[.-]?)?\(?(\d{3})\)?[.-]?)?(\d{3})[.-]?(\d{4})(x\d+)?/i

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe