2 Replies - 632 Views - Last Post: 02 November 2015 - 09:40 AM

#1 Yya09  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 22-October 15

Perl filehandling

Posted 02 November 2015 - 12:19 AM

hi everyone

i make a file in perl for input this is the code
use strict;
use warnings:

open my $file, ">>","file.txt" or die "couldn't open the file";

print $file "what ever i want\n";

close($file);




so when i run the script it is working but my problem is everytime i run it , it will automatically continue inputing the file and it will not delete the last input. so my question is how can i prevent inputing the file without deleting the last input?

your answer is required

thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Perl filehandling

#2 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6560
  • View blog
  • Posts: 30,699
  • Joined: 10-May 07

Re: Perl filehandling

Posted 02 November 2015 - 06:04 AM

Quote

> or w Creates, Writes, and Truncates
>> or a Writes, Appends, and Creates

[source]

View PostYya09, on 02 November 2015 - 03:19 AM, said:

your answer is required

I believe the term you are mean is requested.
Was This Post Helpful? 0
  • +
  • -

#3 Yya09  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 22-October 15

Re: Perl filehandling

Posted 02 November 2015 - 09:40 AM

yes sorry i mean requested . yes i wrote and append it thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1