One thing about this I'd change: C-style for loops are often fencepost errors waiting to happen. When they aren't, they're often easer ways to write it. For example, in this case:for ( my $i = 0; $i <= $#alert; $i++ ) { unless(grep /$process[$i]/ , @ptable) { $alerts{"$alert[$i]"} .= "\n$message[$i]"; } }
While I was at it, I changed from $i to $_ for your index var, and from an unless block to a next if. Those are both more matters of taste then perlishness. Slightly more major: I removed a redundant pair of double-quotes, on "$alert$i". Doing that in this case does nothing but slow you down slightly. In some cases, though, it'll force stringifaction, which is rarely what you want. For example, "$obj"->foo() won't call foo on $obj. Instead, it'll try to call foo on somthing like "Class=HASH(0x089742)", and fail.for (0..@alert) { next if (grep /$process[$_]/, @ptable); $alerts{$alert[$_]} .= "\n$message[$_]"; }
In reply to Re: Anticipation of future needs and other musings from the crystal ball
by theorbtwo
in thread Anticipation of future needs and other musings from the crystal ball
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |