title: How can I use a variable's value as a glob pattern in Perl?
body: <p>In Perl, you can get a list of files that match a pattern:</p>
  
  <pre><code>my @list = &lt;*.txt&gt;;
  print  "@list";
  </code></pre>
  
  <p>Now, I'd like to pass the pattern as a variable (because it's passed into a function). But that doesn't work:</p>
  
  <pre><code>sub ProcessFiles {
    my ($pattern) = @_;
    my @list = &lt;$pattern&gt;;
    print  "@list";
  }
  
  readline() on unopened filehandle at ...
  </code></pre>
  
  <p>Any suggestions?</p>