in reply to guidelines for inline coding
I think it mostly comes down to what looks simple to humans.
Something like do{do{print $_.',' if $_/2 == int($_/2)} for ($_..$_+4); print ' :: '} for (1..50) works, but would be far better as a multiline block.
do {print "K=$_, V=$hr->{$_}\n" if sensibleToDo($_)} for keys %$hr; is still quite a large mouthful.
The do{} can be dropped if you use an and/or in place of the if.
EG:isSensible($_) or send_alert("Help: $_ : $!\n") for (@files).
The niceness depends a lot on what you're actually doing and how well your functions and variables are named. The more the actual statements read like an English sentence, the less there is to complain about.
In general, if you feel a desire to nest post-conditionals, you should consider the option of making the whole line a subroutine instead.
|
|---|