in reply to Text Databases
To get back at the data, you need to dereference the array, i.e. @{$users{$name}}. For example, to get a dump of the users,print join ' ', ($_, map($_, @{$users{$_}}), "\n") for (keys %users);Of course, you'd be better off using a DB file if you can; flat files require you to reinvent the wheel in a lot of ways. Provided tied hashes properly handle array references (which I'm not sure of; I stick to RDBMSs), this should extend to that pretty easily.use strict; my %users; open USERS, "<users.txt"; while (<USERS>) { chomp; my @line = split / /; $users{shift @line} = \@line; } close USERS;
|
|---|