in reply to Style: buried variables or double referencing?
Greetings punch_card_don,
Each of your suggested styles has merit depending on the particulars of the situation. Context is everything. There's nothing in your code examples that would make me shiver if I had to maintain it. (Although, "...many lines of code later..." does cause some pause, I have to admit.) A couple key things to consider:
I tend to write really compact code, but I understand that it can be more difficult for someone else to maintain. Here's what I'd be tempted to do:
for (0 .. (($some_variable eq 'x') ? 14 : 9 )) { print $_, "\n"; # or whatever goes on in here... }
TMTOWTDI, and you've already posted a few good ways.
gryphon
Whitepages.com Development Manager (DSMS)
code('Perl') || die;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Style: buried variables or double referencing?
by punch_card_don (Curate) on Aug 20, 2005 at 16:21 UTC | |
by holli (Abbot) on Aug 20, 2005 at 18:39 UTC | |
by merlyn (Sage) on Aug 21, 2005 at 15:09 UTC |