For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2005 > Re: convert array pair to hash









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: convert array pair to hash
Scott R. Godin

2005-07-24, 8:29 pm

Robert Citek wrote:
>
> On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote:
>
>
>
> Sweeeeet! Thanks a bunch.
>
> Do you have a good reference which explains this? I've looked in both
> the Camel and Llama books, but didn't see the @$ construct anywhere.
>


basically it's shorthand for the more obvious and well documented
@{$reference} notation.

great detail on this can be found in the perldocs: perlreftut perlref
perldsc and perllol

Personally I feel the shorthand way makes it slightly more difficult WRT
maintenance. Fine for one-offs but for long term multiline code, the
long form would likely be preferable as it makes it easier to see just
exactly what's going on there.
Wiggins d'Anconia

2005-07-24, 8:29 pm

Scott R. Godin wrote:
> Robert Citek wrote:
>
>
> basically it's shorthand for the more obvious and well documented
> @{$reference} notation.
>
> great detail on this can be found in the perldocs: perlreftut perlref
> perldsc and perllol
>
> Personally I feel the shorthand way makes it slightly more difficult WRT
> maintenance. Fine for one-offs but for long term multiline code, the
> long form would likely be preferable as it makes it easier to see just
> exactly what's going on there.
>


I recognize that you said "Personally I feel..." so there is certainly
nothing wrong. I will counter that the additional {} just add clutter
where it isn't needed. Another example is parentheses around function
arguments that don't require them. I am not a key stroke counter, but
adding the grouping where it isn't necessary *can* (not "does" for
everyone) make it much more difficult to read because you have to
constantly see where you are matched to.

Just my $.02 on style...

http://danconia.org
Scott R. Godin

2005-07-24, 8:29 pm

Wiggins d'Anconia wrote:
> Scott R. Godin wrote:
[color=darkred]
[snip][color=darkred]
>
> I recognize that you said "Personally I feel..." so there is certainly
> nothing wrong. I will counter that the additional {} just add clutter
> where it isn't needed. Another example is parentheses around function
> arguments that don't require them. I am not a key stroke counter, but
> adding the grouping where it isn't necessary *can* (not "does" for
> everyone) make it much more difficult to read because you have to
> constantly see where you are matched to.


OTOH, it makes it very clear to me that I'm dereferencing a reference to
something, and that it isn't a typo introducing (some|more) line-noise :-)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com