I've reposted this as there was a bad typo in the last one. Anyway, the problem is I can't access the values in the text file. Following is the script:
#!/usr/bin/perl
use strict;
use CGI;
use CGI::Carp qw ( fatalsToBrowser );
use DB_File;
use Fcntl;
print"Content-Type:text/html\n\n";
my(%colors,$dbfile,%HASH,%hash);
my $dbfile="/home/users/public_html/cgi-bin/colors.txt ";
tie (%HASH, "DB_File", $dbfile)or die "Can't open $dbfile: $!\n";
my %colors;
print"$colors{'ffffff'}";
print"$colors{'000000'}";
print"$colors{'ff0000'}";
untie %hash
colors.txt is as follows
%colors=(
'ff0000' =>'red'
'000000' => 'black'
'ffffff' => 'white'
)
With no html added I get a 0(zero) on my browser screen. If I add any html anywhere on the page it appears and the zero goes away but am getting nothing from the text file. I tried putting the .txt file in the cgi-bin and also the httdocs area with the same results.