Yes, that does make more sense. Just one word of caution though... Instead of this:
# Interval to change at if we want $mode = "running"
my $interval = $ARGV[0];
# Change the mode if we have been passed an interval
$mode = "running" if ($interval);
something like this would be more prudent:
my $interval = 0;
if ( @ARGV ) {
( $interval ) = ( $ARGV[0] =~ /(\d+)/ )
or die "Usage: $0 [m]\n m: number of minutes between color cha
+nges\n";
}
$mode = "running" if ( $interval );
That makes sure that you don't try to do arithmetic on a non-numeric string, or sleep for a negative number of seconds.
(update -- minor nit-pick -- since you now have an "interval" variable that is either true or false, you don't really need a "mode" variable, do you?) |