Thanks for the quick reply... Okay, I could use Data::Dumper, but what do you mean by empty leading field? Am I dense? (probably!)
I don't really want to use D::D module, so what would I do to alleviate this? Ensure no leading white space? I'll have to give that a try (but my kids are not lettying me tayp; fdsa right nows.) Tnx! Steve Grazzini <[EMAIL PROTECTED]> had this to say, > Deb <[EMAIL PROTECTED]> writes: > > Still struggling with multilevel hashes. > <snip> >=20 > > while (<DATA>) { > > chomp; > > ($listname, $field) =3D split(/:/, $_); > > print "\nListname is $listname,\nField is: $field\n"; > > %hrLists =3D split(/\s+/, $field); > > $Lists{$listname} =3D \%hrLists; > > } > >=20 > > __DATA__ > > list-1: -x abc -r tenb > > list-2: -x def -r ghi -h tenr > > list-3: -x fel -h asci > > list-4: -x foo -h nonasci -r bfab > >=20 > > I'm getting this output: > >=20 > > Listname is list-1, > > Field is: -x abc -r tenb > > Odd number of elements in hash assignment ... >=20 > You're getting an empty leading field; >=20 > $ perldoc -f split=20 > <relevant bits> >=20 > Splits a string into a list of strings and returns > that list. By default, empty leading fields are > preserved, and empty trailing ones are deleted. >=20 > If EXPR is omitted, splits the "$_" string. If > PATTERN is also omitted, splits on whitespace > (after skipping any leading whitespace). Anything > matching PATTERN is taken to be a delimiter > separating the fields. (Note that the delimiter > may be longer than one character.) >=20 > As a special case, specifying a PATTERN of space > ("' '") will split on white space just as "split" > with no arguments does. Thus, "split(' ')" can be > used to emulate awk's default behavior, whereas > "split(/ /)" will give you as many null initial > fields as there are leading spaces. A "split" on > "/\s+/" is like a "split(' ')" except that any > leading whitespace produces a null first field. A > "split" with no arguments really does a "split(' > ', $_)" internally. >=20 >=20 > So try something like this: >=20 > use Data::Dumper; >=20 > while (<DATA>) { > chomp; > my ($listname, $field) =3D split /:/; > $Lists{$listname} =3D split ' ', $field; > =20 > # > # would have helped you spot it... > # > print "listname:'$listname'\n", > "field: '$field'\n",=20 > Dumper $Lists{$listname}; > } >=20 > HTH > --=20 > Steve >=20 > --=20 > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --=20 =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D- There are 010 types of people in the world: those who understand binary, and those who don't. =F4=BF=F4 111,111,111 x 111,111,111 =3D 12,345,678,987,654,321 (decimal) ~=20 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]