">" and ">>" are pipelines.
For Perl and bash (one of the linux shells) ">" is the standard way to say: "redirect this stuff to the named file and overwrite (delete) its previous contents with this".
And ">>" is the standard way to say: "add this material after the last line of the file (updating this contents) but preserve any previous contents that you found in this file". ">>" works also in perl and in bash
If the file is missing both do basically the same. Create a "box" (the file) and dump all the "bricks" into this box.
So, let's see what are you doing:
open (HAN , ">" ,'D:\RAM\perl\test') or die "$!"; # DELETE the contents of this file and open it while (<HAN>){ s/e/\*\*/ig; # nothing here to mach, the file is empty, no survivor "e" chars print HAN ; # thus, nothing is changed and nothing left to print to the file }
In reply to Re^3: opening file for editing
by pvaldes
in thread opening file for editing
by ramprasad27
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |