perleager has asked for the wisdom of the Perl Monks concerning the following question:

Hello:

When I have this code on my UNIX machine w/ apache it prints out the info from the hash:

use DB_File; # optional; overrides default tie %who, "DB_File", "$path/whosonline" or die "Can't open FILENAME: $ +!\n"; # open database, to be accessed through %HASH # close the database $rank = "0"; foreach $mename (keys %who){ if (-d "$free_path/$mename") { $rank++; print <<EOF; <a href="http://www.teen-reality.com/members/$mename">$mename</a><b>*< +/b>, EOF if ($rank eq "15") { print <<EOF; <a href="http://www.teen-reality.com/members/$mename">$mename<b>*</b>< +/a> ... <a href="http://www.teen-reality.com">more</> EOF last; } else { next; } } else { next; } } untie %who;


But when I put this same exact code on my Windows Machine, it doesnt work.

Anyone know whats wrong? I've installed a DBM Module on the windows machine and could write to a DBM file.

Thank you,
Dave

Replies are listed 'Best First'.
Re: Reading a DBM file on Windows Machine
by chromatic (Archbishop) on May 21, 2001 at 07:08 UTC
    Without an error message, it's very difficult to tell you what's wrong.

    Looking through the code, I'd use File::Spec's catfile() method instead of "$path/whosonline". I'd also remove the string comparison (eq) for checking to see if $rank is 15.

    Those are merely stylistic, probably not fatal.

    What does it say with -w and strict?

      There is no error message when I uploaded it on the windows machine, just doesn't print out what it suppose to.

      Anthony