G'day younggrasshopper13,
For the head part, follow the link already provided
(perlintro).
This will show you how to open a file;
read as many head lines as you need.
For the tail part, this will depend on the size and structure of the file.
Here's some options:
-
For a small file, (<$filehandle>)[-1] will give you just the last line.
If you want more than one tail line,
reverse might come in handy, depending on how you write your code.
-
For fixed-width records, using seek might be best.
-
For large files, the builtin module, Tie::File,
could be a good choice.
-
There's a variety of CPAN modules that might suit you better;
e.g. File::Tail.
You mentioned "first field" and "first column".
If that's referring to CSV, see your earlier post, "parsing CSV";
if it's something else, you'll need to be more specific.
| [reply] [d/l] |
Sure, see perlintro, and try writing something
| [reply] |
Thanks. You guys can just delete this thread. Don't mean to bother.
| [reply] |