|Pathologically Eclectic Rubbish Lister|
Clarification on the write read mode of filehandlingby I_love_perl (Novice)
|on Oct 19, 2013 at 13:16 UTC||Need Help??|
I_love_perl has asked for the
wisdom of the Perl Monks concerning the following question:
I was trying to understand the write read mode of file handling in perl (+>). For the same I've written the below program.
What I was expecting is print statement at line 13 in the code will produce an output of 4. But it did not happen that way. The list was empty and hence the output was blank.
My guess is the write operation into the file has written the data into primary memory and not yet into the secondary storage (Hard disk). The data will be written into secondary storage only when we close the file handle.If the above assumption is right, then is there any way to store the modified data back to the secondary storage by any other means other than closing the filehandle.
If the above assumption is wrong, can someone explain the reason for the above behaviour