Perl - Check if the current time between 9PM and 6AM -
i'm looking best way determine whether current time between 9pm , 6am, , perform relevant action, depending on boolean.
i'm not entirely sure on best way of doing though... i'm thinking maybe use epoch time (time::local) time @ 9pm last night, , time @ 6am following day - best way of doing or there better way?
thanks
this necessary
my $hour = (localtime)[2]; if ( $hour >= 21 or $hour < 6 ) { ... }
Comments
Post a Comment