John Krahn wrote:
> The way I've seen that done sometimes is like this:
> 
> sub frobitz {
>      my %opt = (
>          name => 'blueberry',
>          color => 'blue',
>          texture => 'medium',
>          price = 30,
>          @_
>          );
> 
>      # ... do something useful
> }
> 
> The trailing keys and values in the list override the defaults if they are 
> present.  And of course that won't work for scalars or arrays.
> 

Yeah -- I've seen that idiom used ... and it *IS* much faster, but
always leaves me with the feeling that it's overly obfuscated.
(Although maybe if I forced myself to use it more often I'd be more
comfortable with it... )

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
        Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to