in reply to Re: Passing / evaluating / dieing on one line...
in thread Passing / evaluating / dieing on one line...
Not if it will end up like this:
(my $label_colnum = &column_exists( \@data, $_[1] || 0 )) == -1 and di +e; (my $key_colnum = &column_exists( \@data, $_[1] || 1 )) == -1 and di +e; (my $cross_colnum = &column_exists( \@data, $_[1] || 2 )) == -1 and di +e; # ...
It's easier to cut-n-paste, it's obvious to a maintainer how to add another colnum variable.
If you later want to refactor it's also easier to automate the conversion if the statements are grouped on one line. Simple s/blah (\w) blah (\d) blah die (".*");$/refactorsub(\1,\2,\3);/; or such, no multi-line wierdness ;).
I tend to think of long identicalish lines as a template or macro or pseudo sub type of thing.
Which would you prefer?
do_A; do_B; do_C; do_D; do_A; do_B; do_C; do_E; do_A; do_B; do_C; do_C; or do_A; do_B; do_C; do_D; do_A; do_B; ...
The yaddayaddayadda (...) is going to be one of my favorite operators in Perl 6 ;)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Data structures drive logic! (was Re3: Passing / evaluating / dieing on one line...)
by dragonchild (Archbishop) on Apr 05, 2002 at 16:05 UTC | |
by particle (Vicar) on Apr 05, 2002 at 18:45 UTC | |
by dragonchild (Archbishop) on Apr 05, 2002 at 18:59 UTC |