Also look at the sort docs; on the whole, though, your sort function will be pretty simple if you create your data structure wisely.
If it were me, I'd create a hash where the keys are your TYPEs, and the values are array references; these array references would hold the "records" read in from your file. This code will help to get you started setting up such a structure:
You can take a look at the resultant data structure by using Data::Dumper:my %data; while (<>) { chomp; my %rec; @rec{ qw/type url name description/ } = split /,/; push @{$data{$rec{'type'}}}, \%rec; }
As chromatic said, if you're going to do much more than simple database work, take a look at DBI. DBD::CSV might come in handy for you, or you may want to look at a "real" database, like MySQL. SQL will do a lot of the work for you implicitly if you store your data in a database.use Data::Dumper; print Dumper \%data;
In reply to Re: Newbie help
by btrott
in thread Newbie help, again
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |