The contents of the file are not appended to the STDOUT. Please guide how to do that.use warnings; print "Enter the name of the file:\n"; $filename = <STDIN>; chomp($filename); open MYFILE, "$filename" or die "Error in opening: $!"; print "Enter your text:\n"; $new_text = <STDIN>; chomp($new_text); print "\nYour new file contains: $new_text\n"; open MYFILE, ">>$filename" or die "Error in opening: $!"; print MYFILE "$new_text\n"; while(my $line = <MYFILE>) { print "$line\n"; } close(MYFILE);
In reply to Contents of file not printed to STDOUT by nt2282
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |