title: get latest file from directory with pattern matching: Perl
body: <p>I am newbie to perl and working on a script to find the files with pattern matching having latest modified timestamp and copy to another location.</p>
  
  <p>my code is working on Mac, but having issues on windows server.</p>
  
  <pre><code>use strict;
  use warnings;
  
  use File::stat;
  
  my $UNC ="/Users/documents/";
  my $FileNamePrefix = "abc*.csv";
  my @files = sort {stat($a)-&gt;mtime &lt;=&gt; stat($b)-&gt;mtime} glob($UNC.$FileNamePrefix);
  
  my $Recon = $files[-1];
  print "Latest   = $Recon\n";
  </code></pre>
  
  <p>can someone please help me with this code, Thank you</p>
  
  <p>Source location:
  abc_20181.csv   (yesterdaydate)
  abc_20182.csv   (todaysdate)</p>
  
  <p>Target location:
  abc_20182.csv</p>