Question: Can someone help me with my Perl script? For some reason, open($info, >info.txt) clears the file but fails to write the data into it. I've
Can someone help me with my Perl script? For some reason, open($info, ">info.txt") clears the file but fails to write the data into it. I've used an array of methods for writing into the file, and even the append and "+" combinations fail to work. The "append" methods don't even write into the file at all. I've even used ">>", "+>", and "+>>" with no luck. The "w", "r", and "a" always gives me this: Can't open data at /cygdrive/c/Users/admin/Desktop/a14.pl line 11, line 3.
The current script I've attached to this message results in the following output: ------------------------------------------------------------------------------- admin@Dell /cygdrive/c/users/admin/desktop $ perl /cygdrive/c/Users/admin/Desktop/a14.pl
Full Name: Firstname Lastname
Age: 30
Gender: Female
Marital Status: Single
Do you want to change the age? (Y/y or N/n): y What is the new age? 27
Do you want to change the Marital Status? (Y/y or N/n): n The result is: Full Name: Age: Gender: Marital Status: admin@Dell /cygdrive/c/users/admin/desktop $ perl /cygdrive/c/Users/admin/Desktop/a14.pl
Full Name: Age: Gender: Marital Status:
Do you want to change the age? (Y/y or N/n):
admin@Dell /cygdrive/c/users/admin/desktop $
-------------------------------------------------------------------------------
Here's the script -------------------------------------------------------------------------------
#!/usr/bin/perl open(DATA,"
open(DATA,"
Is it because Cygwin's incompatible? Is it the script itself? I don't know if it's a software issue, an error in my script, or if it's my system. Is there any advice or tips that you can provide? Thank you.
Step by Step Solution
There are 3 Steps involved in it
Lets break down the script issues and see how we can correct them step by step Step 1 Problem Identi... View full answer
Get step-by-step solutions from verified subject matter experts
