Rmck wrote:
I have a script that I want to print only if between 08:00 and
17:00. Would I match every hour then print?? Any cleaner way to do
this would be great. Thanks
my($sec,$min,$hour,$mday,$mon);
($sec,$min,$hour,$mday,$mon)=localtime;
You can declare and assign the variables in the same expression:
my ($sec,$min,$hour,$mday,$mon) = localtime;
<snip>
if ( $hour =~ /^(08:|09:|10:|11:|12:|13:|14:|15:|16:|17:)/){
What made you think that $hour would contain a string with a trailing
colon character?
You can simply do:
if ( $hour >= 8 and $hour < 17 ) {
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>