Irfan Sayed <irfan_sayed2...@yahoo.com> asked:

> I have perl script like this :
[...]
> open (VER1, "+>",
 [...]
> while (<VER1>) {
[...]

> the issue is that , it is executing properly till while loop but it is
> not going inside the while and executing while loop.
> there is no any error and all the files are present in their location.

>From "perldoc perlopentut":

"It is possible to specify both read and write access.  All you do is add a "+" 
symbol in front of the redirection.  But as in the shell, using a less-than on 
a file never creates a new file; it only opens an existing one.  On the other 
hand, using a greater-than always clobbers (truncates to zero length) an 
existing file, [...]".

I.e. use '+<' if you intend to read the old contents of the file before you 
start writing to it.

HTH,
Thomas


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to