Hi,
I am doing this perl script
print (@line(1..15));
the lines 1 to 15 get printed...
how can i redirect this to file?
thanks and regards
vivek.s
Hi,
I am doing this perl script
print (@line(1..15));
the lines 1 to 15 get printed...
how can i redirect this to file?
thanks and regards
vivek.s
There are two ways. The really simple method is to just redirect to a file. Anything that gets printed to STDOUT (by default, print goes to STDOUT) will go to a file.
`myPerlRoutine.pl > myFile.txt`
Or you can do it in code:
open (LOGFILE, ">logfile.txt") || die "$!";
# <blah blah blah>
print LOGFILE (@line(1..15));
close(LOGFILE);
Hi!
I want to do it in the same file which i opened for editing.........without creating temporary files....can this be done?
THANKS!!!
Regards
Vivek.S
If you have a filehandle which you previously open()ed for writing, you can print() to it.
Thanks!!
regards
vivek.s