Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

create file for writing

Posted on 2011-04-23
2
Medium Priority
?
236 Views
Last Modified: 2012-05-11
Hi experts,
I want to open a file for writing. I want the file you be created new(I don't want you append). If the file already exists, delete it and start new. How should I use open.
0
Comment
Question by:ambuli
2 Comments
 
LVL 28

Accepted Solution

by:
FishMonger earned 1000 total points
ID: 35454177
my $file = 'path/to/file';
open my $fh, '>', $file or die "failed or create <$file> $!";

Open in new window

0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 1000 total points
ID: 35454231
open(IN,'>file');
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question