Good morning most gracious of monks.
Being a relative noob, I'm looking on some good information on Perl records, I've looked around google and this site, only coming up with the basics ie.
@records = ( {field1 => 'row1-1', field2 =>'row1-2'},
{field1 => 'row2-1', field2 =>'row2-2));
foreach my $row (\@records)
{
#..Do some stuff..
}
Specifically, I'm trying to load the contents of a pipe-delimited file into a record. The end goal of what I'm doing is creating an FTP service, the config file is what stores various things such as frequency of polling, etc etc.
So, here's my questions:
- How do I pre-define the record type, so I can use it throughout my scripts (I am aware I can create it in a "require my_library.pl" file.)
- Is there a method to suck the entire contents of the file into the @records variable at once, putting everything in it's place?
I should also add, I can't really add new modules, the sys admins take weeks here to add a new modules, the approval process is simply brutal (public sector).
If someone has a link that I've overlooked, a small example, or something relevant they think would be a help, I would greatly appreciate it.
Thanks again most brilliant of monks.
20080119 Janitored by Corion: Fixed UL tag, as per Writeup Formatting Tips
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.