title: How can I extract date information in YYYYMMDD format from a file name?
body: <p>I am new to Perl and  have  a string in the format <code>XXXX_XXX_YYYYMMDD.txt</code>.</p>
  
  <p>How can I extract <code>YYYYMMDD</code> part in another string?</p>
  
  <p>Below is what I tried</p>
  
  <pre><code>my $filename = "XXXX_XXX_YYYYMMDD.txt";
  my $datepart = split($filename ,'.');
  print "$datepart";
  </code></pre>