I know I'm doin this really badly, and my code still doesn't work.
I trying to use a flat tab delimited file for a database for a simple shopping site.
Each record has several elements - including color, name, description, type, etc.
I trying to write a CGI that loads all records into differnt arrays or hashes so I can test against them later (like to find related products, or relevant other content)
so:
sub open_file {
$t=1;
open(MYFILE,"c:/websites/manlywear221/manlywear.com/anna_pratti/list.txt") || die "Can't open database";
@list=<MYFILE>;
while(<MYFILE>) {
chomp;
($j_number[$t], $j_type[$t], $j_type_number[$t], $j_color[$t], $j_combo[$t], $j_name[$t], $j_descrip[$t], $j_price[$t])= (split /\t/);
$t++;
}
close(MYFILE);
}
now when I try to print let's say:
print $j_color[1] - I would think that it would print the color from the 1st record read into the subroutine - but it's printing nothing - please some help!!!
I trying to use a flat tab delimited file for a database for a simple shopping site.
Each record has several elements - including color, name, description, type, etc.
I trying to write a CGI that loads all records into differnt arrays or hashes so I can test against them later (like to find related products, or relevant other content)
so:
sub open_file {
$t=1;
open(MYFILE,"c:/websites/manlywear221/manlywear.com/anna_pratti/list.txt") || die "Can't open database";
@list=<MYFILE>;
while(<MYFILE>) {
chomp;
($j_number[$t], $j_type[$t], $j_type_number[$t], $j_color[$t], $j_combo[$t], $j_name[$t], $j_descrip[$t], $j_price[$t])= (split /\t/);
$t++;
}
close(MYFILE);
}
now when I try to print let's say:
print $j_color[1] - I would think that it would print the color from the 1st record read into the subroutine - but it's printing nothing - please some help!!!