title: Create a file in a directory using Perl
body: <p>How can I create a new file, in which I intend to write in a existing directory using open() in Perl?</p>
  
  <p>I tried like this:</p>
  
  <pre><code>my $existingdir = './mydirectory';
  
  open my $fileHandle, "&gt;&gt;", "$existingdir/filetocreate.txt" or die "Can't open '$existingdir/filetocreate.txt'\n";
  </code></pre>
  
  <p>But it won't work.</p>