The light is beginning to shine a little brighter...
Joseph's cogent explanation of dereferencing is helpful. Thanks.
Yesterday I went out and bought the 3rd edition to the Perl reference book by
ORA (mine was a very old 1st edition). The 3rd edition has a whole lot more
on references than the
deb wrote:
> I'm not sure what you're saying. Since this is an anonymous hash assignment,
> how do I pull out the $listkey? Do I need to pre-assign it? For example,
> I tried this, added to the previous program,
>
> foreach $listname (sort keys %Lists) {
> print "$listname:\n";
> foreac
Thanks, Steve, for your feedback. As I said in private email to Steve
earlier today, I don't mind someone thumping the FM to me - problem is, I've
been reading all the FM I could find, including all those mentioned here.
Got the printouts right in front of me.
But I've been confused by different
Deb <[EMAIL PROTECTED]> writes:
>
> I understand this:
>
> foreach $listname (sort keys %Lists) {
> print "$listname\n";
> }
>
> But, I don't quite get how to get to the key values
> below that. I know I'm so close, but just not quite
> there...
>
> Could some kind soul give me a blow by
Deb wrote:
> You know, I'm just not "getting it" I guess. When I read through
> simple of examples in perldsc and perlfunc, it seems straightforward
> enough, but when I try to put into practice everything, it doesn't go
> as I might expect.
>
> Recall this code I posted a day or two ago:
>
> -
I'm not sure what you're saying. Since this is an anonymous hash assignment,
how do I pull out the $listkey? Do I need to pre-assign it? For example,
I tried this, added to the previous program,
foreach $listname (sort keys %Lists) {
print "$listname:\n";
foreach $key (sort keys %Lists)
-->8-
"I understand this:
foreach $listname (sort keys %Lists) {
print "$listname\n";
}
-->8-
To get the values instead of the keys, you will have to do something like
this:
foreach $listkey (sort keys %Lists){
print "$List
You know, I'm just not "getting it" I guess. When I read through
simple of examples in perldsc and perlfunc, it seems straightforward
enough, but when I try to put into practice everything, it doesn't go
as I might expect.
Recall this code I posted a day or two ago:
8-< -- snip
Deb wrote:
> 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
All,
Replying to my own post - yup, that did it. I removed the leading
space(s), then did the hash ref assignment, and all was well.
Whew!
Thanks for the tip - and the pointer that I should have checked the
docs... sometimes the problem is that I'm just not sure *which* doc
would have the inf
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 lett
Deb <[EMAIL PROTECTED]> writes:
> Still struggling with multilevel hashes.
> while () {
> chomp;
> ($listname, $field) = split(/:/, $_);
> print "\nListname is $listname,\nField is: $field\n";
> %hrLists = split(/\s+/, $field);
> $Lists{$listname} = \%hrLists;
> }
>
> __DATA_
12 matches
Mail list logo