Opening data files, reading from them, and writing to them. Checking whether files exist. And if so, how big are they? Using the file handling elements of Perl to handle keyboard, screen, other processes, and connections to other computers.
This topic is presented on public courses
Perl Programming,
Perl bootcamp
Examples from our training material
| addplus | Formatter - adding a leading plus |
| christmas | Formatted printing - splittin money between the grandchildren |
| ddd | Splitting and reformatting data |
| fan | One input and five output files in a single program |
| fsv | File open, read, write test example |
| leedspark | alternative answer to practical at end of module |
| legacy | Divide money between children and print neatly |
| output.txt | Sample output "park" program |
| park | Sample answer to "the park" exercise |
| perlwget | Running an OS command from within a Perl script |
| piper | Use of file handles to pipe from and to processes |
| procmon | Process monitoring - demonstration of principle |
| reporter | file status operators -x and -s |
| sp | Formatted printing |
Opentalk forum discussions related to this topic
reading a text file and extracting infoWritting a script to break a fileupdating a filereading rc filesperl basicVariable formatting beyond printf
Pictures
"Now where was that data file??"
"Now where did I save that data file?"
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
File input and output.
File Handles.
The open function.
Reading from a file handle.
Writing to a file handle.
Closing a file.
Other things you can handle through the file interface.
File testing.
Formatted printing.
Floating point formats.
Formats for whole numbers (integers).
Formats for variable text strings.
Constant text.
sprintf.
Summary.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 600 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.