title: How to print a variable to a file in Perl?
body: <p>I am using the following code to try to print a variable to file.</p>
  
  <pre><code>my $filename = "test/test.csv";
  open FILE, "&lt;$filename";
  my $xml = get "http://someurl.com";
  print $xml;
  print FILE $xml;
  close FILE;
  </code></pre>
  
  <p>So <code>print $xml</code> prints the correct output to the screen. But <code>print FILE $xml</code> doesn't do anything.</p>
  
  <p>Why does the printing to file line not work? Perl seems to often have these things that just don't work...</p>
  
  <p>For the print to file line to work, is it necessary that the file already exists?</p>