title: Why can't I use the diamond operator with an array in Perl?
body: <blockquote>
    <p><strong>Code</strong></p>
  </blockquote>
  
  <pre><code>$ cat test1
  hello 
  i am 
  lazer
  
  nananana
  $ cat 1.pl
  use strict;
  use warnings;
  
  my @fh;
  open $fh[0], '&lt;', 'test1', or die $!;
  
  my @res1 = &lt;$fh[0]&gt;;  # Way1: why does this not work as expected?
  print @res1."\n"; 
  
  my $fh2 = $fh[0];
  my @res2 = &lt;$fh2&gt;;    # Way2: this works!
  print @res2."\n";
  </code></pre>
  
  <blockquote>
    <p><strong>Run</strong></p>
  </blockquote>
  
  <pre><code>$ perl 1.pl
  1
  5
  $
  </code></pre>
  
  <p>I am not sure why <code>Way1</code> does not work as expected while <code>Way2</code> does. Aren't those two methods the same? What is happening here?</p>