The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by hoffmanm8]

Hey all. I feel a bit ridiculous having trouble right after getting out the
gate, but here I am.

I have been trying to wrap my head around a error that comes up from the cd
count program on page 24. When I run the code I am finding the log file
having entries like:

1971: HASH(0x156156c) ->(1971) # not what I was expecting!

Also with this message:
Use of uninitialised value in hash element at cd_count.pl line 23, <STDIN>
line 6.

I downloaded the source code and got this message:

Use of uninitialised value in hash element at cd_full.pl line 23, <STDIN> line
13.

So I'm starting to think that there maybe a problem with my platform. I am
running ActiveState Perl (5.8.1) build 807 on a Windows 98 box.

Has anyone else had this problem? Am I just a doofus?

Thanks in advance for your help!

Cheers!
Matt
import-bot (20211) [Avatar] Offline
#2
Re: cd_count.pl problem on win9x
[Originally posted by dave]

> Hey all. I feel a bit ridiculous having trouble right after getting out the
> gate, but here I am.
>
> I have been trying to wrap my head around a error that comes up from the cd
> count program on page 24. When I run the code I am finding the log file
> having entries like:
>
> 1971: HASH(0x156156c) ->(1971) # not what I was expecting!

I expect that's because you have the wrong kind of brackets on line 32. It
should be $counts->{$_} but I think you have $counts->($_).

> Also with this message:
> Use of uninitialised value in hash element at cd_count.pl line 23, <STDIN>
> line 6.
>
> I downloaded the source code and got this message:
>
> Use of uninitialised value in hash element at cd_full.pl line 23, <STDIN> line
> 13.
>
> So I'm starting to think that there maybe a problem with my platform. I am
> running ActiveState Perl (5.8.1) build 807 on a Windows 98 box.
>
> Has anyone else had this problem? Am I just a doofus?

Nothing wrong with your platform at all. I think you're using an input file in
the wrong format. Note what it says in the introduction to that section on
page20.

"We'll assume that we have a tab-separated text file where the columns are
artist, title, record label, and year of release."

Note that the cd.txt file in the c2 directory is _not_ in that format. You'll
need to create your own which is in the correct format. You could create it
from the cd.txt file by doing the following two things:

1/ Remove all header and footer lines, leaving just the six data lines.

2/ Replace the multiple spaces between the data items with a single tab
character.

hth,

Dave...