How to write multiple lines to a file from user input (Perl)
<p>I am trying to do a simple perl program that takes user input and writes it to a file. However I want to be able to have multiple lines in the file instead of the entire user input being on one line (for example the users types \n so move to next line in file)</p>

<p>Here is my current code </p>

<pre><code>sub addContentToFile {

    my ($self) = @_;
    open(my $fh, '&gt;&gt;', $self-&gt;{path}) or die "Could not open file: " .$self-&gt;{path};
    print "File is open for writing...\n";

    #my $input = $self-&gt;{content};
    my $input = &lt;STDIN&gt;;

    print $fh $input;

    print "Added  : " .$input
         ."To File: " .$self-&gt;{path} 
         ."\n";

    close $fh;
    print "\nFile Closed.\n";
}
</code></pre>