title: Sorting of file name into an array using Perl and Regex
body: <pre><code>sub open_directory {
      my $directory = shift @_;
      my @files = ();
  
      opendir (my $dh, $directory) or die "Couldn't open dir '$directory' : $!";
      my @all_files = readdir $dh;
      closedir $dh;
  
      foreach my $files(@all_files){
              while($files =~ /\.htm/){
                  push(@files);
              }
      }
      return @files;
  }
  </code></pre>
  
  <p>The error is at the code <code>push(@files);</code>
  The error is : 
  <code>Useless use of push with no values</code></p>
  
  <p>I want to process the files with the the name ending of <code>.htm</code> or <code>.html</code> in the <code>@files</code> array using the regex <code>/\.htm/</code> please help me.</p>