title: Creating a file name using variables in Perl
body: <p>I am trying to write out to a file, where the file name is created from a variable(the name + the user id + the date and time + file extension).</p>
  
  <p>I have read various things on Stackoverflow which I have based my code off.</p>
  
  <pre><code>my $windowsfile = "winUserfile-$User_ID-$datetime.csv";
  open winUserfile, "&gt;&gt;", $windowsfile) or die "$!";
  print winUserfile "User_ID, Expression\n";
  close winUserfile;
  </code></pre>
  
  <p>I would assumed this would work, but I am getting a syntax error. Would anyone be able to help?</p>