I'll second Bloodnok's suggestion, but take it a bit further.
First off, you probably shouldn't have "my ($id_name, $filename, $last_name, $first_name, $alignment, $generic_class_name, $class_name, $generic_race, $race, $gender, $experience, $strength, $dexterity, $constitution, $intelligence, $wisdom, $charisma) = qw(test) x 17;". You probably should just use a hash: "my %character;", or, if you want to initialise it all, "my %character = map { $_ => 'test' } qw/id_name filename last_name first_name alignment generic_class_name class_name generic_race race gender experience strength dexterity constitution intelligence wisdom charisma/;" (and if you do this, you can use one of the Hash modules to lock the keys, though I don't bother).
Once you do this, then accepting what Text::CSV gives you shouldn't be such a big deal.
What's more, I generally don't use Text::CSV or it's bigger brother, Text::CSV_XS. Well, not directly. I use DBD::CSV (which uses Text::CSV_XS under the covers). By treating your CSV file as a table in a database, some things get a bit easier. Like letting the DBI/DBD code do the looping for you when you want to extract certain character(s). Or just certain elements of the character.
I have to admit ... I'm curious as to why you need Tie::IxHash. Nevermind - you want to control the order that everything comes out, I see that now.
PS: if you want your ability scores, you can just do this:
my %ability_scores = map { $_ => $character{$_} } qw/strength dexter +ity constitution intelligence wisdom charisma/;
In reply to Re: How to set variable names using Text::CSV?
by Tanktalus
in thread How to set variable names using Text::CSV?
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |