First off, it is very difficult to determine if there is a better way of structuring the data when you haven't presented us with any example data. This node on
Re: How can I visualize my complex data structure? was suggested to me a while back and has been fantastically useful with trying to actually visualize my complex data structures. Especially when I am forced to work with data that I don't have control over how its handed to me.
That being said, have you considered an array of hashes. Since a hash is, at its simplest, an associative array, you can create an array with named hashes. But like I said before, without example data, its difficult to help you any further with organizing data.
Depending on how the datafile is structured (also something that would be helpful if you provide), you do something like the following:
@combined = split /,/, $opt_f;
Side note, I am a personal fan of using GetOpt::Std with the hash format this way I can always Data::Dumper all the options provided as opposed to just one at a time:
use Getopt::Std qw(getopts);
getopts('f:', \%opt);
if ($opt{'f'}) { ... }
# Debug
print Dumper (\%opt);
Eric
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.