File IO (Input and Output)

File IO is used a lot and it is very easy to do thanks to same simple Perl commands.


When you open a file for writing you use w as the second argument for the FileHandle constructor.

use FileHandle;
$MyFile = new FileHandle "temp.txt","w";
for($A = 0; $A < 10; $A++)
    print $MyFile "Line $A\n";
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License