How do you open a file for writing?

Answer Posted / raghav

To open a file:

open (FILE, "<raghav.txt") || die ("File Cannot be opened");

Where FILE is the file handle for this file.
Here the file is opened in read mode.
Put > for write mode
put >> for append mode.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?

2495


How we can navigate the xml documents?

533


What is perl unshift array function?

515


Explain grooving and shortening of arrays?

700


How do you you check the return code of a command in perl?

575






What is the difference between use and require in perl?

464


What is the use of "stderr()"?

567


What happens when you return a reference to a private variable?

524


Explain the default scope of variables in perl?

509


How do you match one letter in the current locale?

551


How to compare two strings in perl?

539


Why -w argument is used with perl programs?

552


What is chomp() operator/function?

561


How are parameters passed to subroutines in perl?

499


What is cpan ? What are the modules coming under this?

498