cosmicsoup has asked for the wisdom of the Perl Monks concerning the following question:
If I reference a foreach $key statement, I can display my id's quite nicely. But if I try to display the rest, I get some output like 13423 - HASH(0x11d4a4). What I want is to use each element in Hash when I want to. Display NAME, PHONE if I wanted to, or NAME, ADDRESS if I wanted to.#!/usr/bin/perl my %ACCTS = (); open(IN, "< myfile") || die "Help!\n"; while (<IN>) { ($id, $name, $street, $city, $zip, $phone, $start_dt) = split(/\|\|/, +$_); $ACCTS{$name}{$street}{$city}{$zip}{$phone}{$start_dt}=$id; } close IN;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to use hashes well
by Abigail-II (Bishop) on Oct 31, 2003 at 17:19 UTC | |
by Roger (Parson) on Nov 01, 2003 at 10:45 UTC | |
|
Re: How to use hashes well
by agh (Novice) on Oct 31, 2003 at 17:54 UTC | |
|
Re: How to use hashes well
by injunjoel (Priest) on Nov 01, 2003 at 01:31 UTC |