If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
Post a reply to the thread: File input/output in PERL! How to do it?
Click here to log in
What color is our footer?
You may choose an icon for your message from this list
Will turn www.example.com into [URL]http://www.example.com[/URL].
You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.
File input/output in PERL! How to do it? This is my perl program open(MYINPUTFILE, "<sampleinput.txt"); while(<MYINPUTFILE>) { my($line) = $_; chomp($line); $line =~ tr/[a-z]/[A-Z]/; print "$line\n"; } close(MYINPUTFILE); open(MYOUTFILE, '>sampleoutput.txt'); print MYOUTFILE "$line"; close(MYOUTFILE); This program is basically supposed to 1) Take text from sampleinput.txt 2) Put it in the string variable called "line". 3) Convert all text in "line" to upper case. 4) Print the result. 5) Store the contents of the "line" string in sampleoutput.txt The program seems to execute the first 4 steps correctly, but I can't get it to do the 5th i.e store the capitalized contents in the file. How to make it so?
File input/output in PERL! How to do it?
Forum Rules