title: How can I store user input inside a text file in perl?
body: <p>I'm trying to create a text file that will store user input such as their initials.  This code will prompt the user for the information and create a text file but the text file remains empty. How can I get the information to store itself inside the text file? I've tried using the variant $initials but it's not storing the information. I can't seem to figure out what I'm doing wrong. </p>
  
  <pre><code>use strict;
  use warnings;
  
  print "Enter users initials: ";
  my $initials = &lt;STDIN&gt;;    # prompts user for input
  
  open( MYFILE, '&gt;&gt;initials.txt' );    #creates file initials.txt
  while (&lt;MYFILE&gt;) {
      chomp;
      print MYFILE $initials;
  }
  close(MYFILE);
  </code></pre>