in reply to Re: Control Structures
in thread Control Structures
I love the look of this, because I really wanted to make the code look cleaner and I have been looking for a chance to use the Ternary Conditional Operator.
Could I swap out the print statements for subroutine calls and move the success and failure things to something like &failure and &success?
Something like:
my $CMD="some command"; system("$CMD"); ( $? == 0 ) ? &success($time, $hostname) : &failure($time, $hostname) +;
and then shift these scalars inside the subroutines?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Control Structures
by ghenry (Vicar) on Apr 29, 2005 at 14:21 UTC | |
by tlm (Prior) on Apr 29, 2005 at 15:30 UTC | |
by ghenry (Vicar) on Apr 29, 2005 at 19:27 UTC |