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 Development Manager (DSMS)
code('Perl') || die;