Reputation:
This is my code to handle file. I am having the file in my drive.
But I always getting file not found error. Do I need to give correct path ? Or Do the code will create a new file here ?
Why am I getting this error ?
Am I store the file in specific path ?
Do I missed anything to mention or Do I missed anything in the code ?
#open FH , ">>JEEVA.csv" or die "File not found";
#print FH $res1;
#close FH;
Upvotes: 0
Views: 1895
Reputation: 3253
Sometime environment path will not be set properly. So try to restart your pc. Then it may work. If this is not working, then we'll try to find another problem.
Upvotes: 0
Reputation: 109532
open(my $fh, ">>", "JEEVA.csv") or die "Cannot open JEEVA.csv: $!";
print $fh $res1;
close $fh;
To go sure on FH.
Upvotes: 1
Reputation: 5664
Your program may not have permission to write to the file in the current directory. Make it print out the error message that explains why it couldn't open the file:
open FH, ">>JEEVA.csv" or die "could not write to JEEVA.csv: $!";
Upvotes: 6