If this is exactly the code you're dealing with, then some of the if's can be removed:
You don't need the first if.if($action) { #Bond the built-in and accessory components to the parent. if($action eq "BOND") {
can be flattened out tofor my $acc (@acc) { ... if ($current_status->{"curr_parent_id"} != 0) { print "Refusing to modify the status of demstock $acc. It has alre +ady been moved<br>\n"; } else { ... }
which removes one level of indentation (and again in the second loop).for my $acc (@acc) { ... if ($current_status->{"curr_parent_id"} != 0) { print "Refusing to modify the status of demstock $acc. It has alre +ady been moved<br>\n"; next; } ...
The other three levels are necessary, since you're testing three different conditions: the value of $action, the location, and the elements of @built (well, unless you're willing to start calling DIE to abort the flow).
I'd suggest that you use separate variables for the queries though, rather than recycling $sth all the time. Then (as well as being more readable), they can be pre-prepared, using placeholders.
--
Tommy
Too stupid to live.
Too stubborn to die.
In reply to Re: A question of style.
by tommyw
in thread A question of style.
by davis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |