in reply to Re: Re: Splitting a hash
in thread Splitting a hash
Why was my snippet ignoring the data?
Well let's examine your snippet:my ($number, $email, $address1, $address2) = split "\0", $dbm{$name}; foreach (sort keys(%dbm)) { print "$dbm{$_}\n"; }
Your first line does a split on null characters of the hash record with a key of $name, the result is returned to several variables which aren't used again in the snippet. Then you loop around the hash, by key, and print the values.
dws's example put the split inside the loop and then prints out the values split returned.
--
Life is a tale told by an idiot -- full of sound and fury, signifying nothing. William Shakespeare, Macbeth
|
|---|