in reply to Re^4: How to ask user for file name and save the output to a new text file
in thread How to ask user for file name and save the output to a new text file
open my $writehandle "+>", $filetowrite # must be open my $writehandle , "+>", $filetowrite
PS pay attention: while(<$writehandle>) will never work: the pointer is to the end of file when you try to reaad from that handle: You can use seek to rewind it but probalby it will be better another strategy: instead of writing to a file accumulate the output into an array.
Then you can foreach my $line (@out_array){ # do whatever you want...
PPS if you provide an example data you are grabbing and the expected output for sure some monk can suggest a better way to handle your data: I suspect you have a filehandle or two more than necessary..
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: How to ask user for file name and save the output to a new text file
by mmazlan67 (Novice) on Jun 20, 2017 at 03:15 UTC | |
by Discipulus (Canon) on Jun 20, 2017 at 07:22 UTC |