How do you open a file for writing?

Answer Posted / raj

Files are opened using the open and sysopen function.
Either function may be passed up to 4 arguments, the first
is always the file handle thenfile name also known as a URL
or filepath, flags, and finally any permissions to be
granted to this file.

$FH = "filehandle";
$FilePath = "myhtml.html";

open(FH, $FilePath, permissions);
or
sysopen(FH, $FileName, permission);

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of “_file_ literal” and “_line_ literal” in perl?

532


How can information be put into hashes?

531


What is the function of cgiwrap in cgi programming?

489


How can we create perl programs in unix, windows nt, macintosh and os/2 ?

477


You want to add two arrays together. How would you do that?

480






What does 'do' statement do in perl?

495


How many loop control keywords are there in perl?

555


Which functions in perl allows you to include a module file. State their differences.

524


Define print() function in perl?

550


Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

541


Explain tk?

515


How do find the length of an array?

516


What are the arguements we normally use for perl interpreter?

503


Mention how many ways you can express string in Perl?

576


How to deleting an existing file in perl programming?

494