Perl code to check date and check files in particular dir

Hi Experts,

I am checking how to get day in Perl.
If it is �Monday� I need to process�below is the pseudo code.
Can you please prove the code for below condition.

if (today=="Monday" )
                 {
                             while (current_time LESS THAN  9:01 AM)         
                             {
                             check_files()       
                             }
                             
                }

 check_files               
      {
                  if (files are there  tmp/ajay/ dir)
                  {
                 Core functionality ;
                 exit();
                  }
                  else
                  {
                  sleep (15 Min)   
                  }
     }

Hope this will help you.

#!/usr/bin/perl

use strict;

sub check_files
{
        my $dirname = "/tmp";
        opendir(my $dh, $dirname) or die "Not a directory";
        if( scalar(grep { $_ ne "." && $_ ne ".." } readdir($dh)) > 0 )
           {
                print "Core functionality \n";
                exit;
           } else {
              sleep 15;
           }
}


my @datetime=localtime(time);
my $hr=@datetime[2];
my $wday=@datetime[6];

if ( $wday eq 1 )
{
        while ( $hr lt 9 )
        {
                check_files()
        }
}

exit;