Welcome to TSDN and Welcome to Perl!
First, I would suggest you read the online book
Beginning Perl. This will definitely help you get started.
Second, there are many references on the web that you will want to visit quite frequently.
CPAN is where you will find all of the Perl modules for use in your coding.
Perldoc is where you will find loads of documentation on all things Perl.
Speaking of perldoc, a couple of pages you should examine regarding opening and adding to files are the
open() function, which is what is used in perl to open files for reading, writing, reading/writing, appending, etc. And, the
perlfunc page, which goes over the standard functions that are included in the default distribution of Perl.
When you open a file, for writing to for instance, you would use the following syntax:
-
open(FILEHANDLE, ">./file.txt");
-
This will first check and see if file.txt exists in the current directory. If it does not, it creates it, then, it opens it for writing to. The ">" tells perl it is only to write to the file. FILEHANDLE is the file handle you would use when referencing the open file. Here is how you would print a line of text to the open file:
-
print FILEHANDLE ("Print some text to the file.\n");
-
That will output to the opened file referenced by FILEHANDLE. This is just an example to get you started. Read the open() function page I gave you a link to and it will explain more for you. Plus, the online book link I provided will also go over that, plus a whole lot more.
If you have any further questions, please do not hesitate to ask them here. If you are asking about code you are working on, please be sure to provide that code here so we can see it and help you. When supplying code in your postings though, please put code tags around the code as well.
Regards,
Jeff