in reply to Loading file into memory
If you want to use arrays to save space, it can be helpful to set up constants for your indexes.
use constant ID => 0; use constant FIRST_NAME => 1; use constant INITIAL => 2; use constant LAST_NAME => 3; # Processed data would look like this: my @data = ( # ID FNAME MI LNAME [qw( dramaya Daniel R Amaya )], [qw( bjsmith Bob J Smith )], [qw( abjones Angela B Jones )], ); # Access your data: foreach my $entry (@data) { my $id = $entry->[ID]; my $fname = $entry->[FIRST_NAME]; # or you could do: my ( $first, $mi, $last, $id ) = @{$entry}[ FIRST_NAME, INITIAL, LA +ST_NAME, ID ]; }
Using constant array indexes can be a nice help for readability.
TGI says moo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Loading file into memory
by walkingthecow (Friar) on Aug 05, 2008 at 20:56 UTC | |
by TGI (Parson) on Aug 05, 2008 at 21:16 UTC |