Gossamer Forum
Home : General : Perl Programming :

Need some help with the subcategory-mod!!

Quote Reply
Need some help with the subcategory-mod!!
Hye all, this is the code i'm using for figuring out the subcats of a cat:

open (REAL, "<$db_category_index") or &cgierr("unable to open database: $db_category_index. Reason: $!");
LINE: while (<REAL> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
if (/.+$delim($my_path.+)$delim(.+)/) {
if ($1 ne /$my_path\/.+\/.+/) {
chomp $1;
chomp $2;
($1 eq /^\s*$/) and next LINE;
$subcat = "$2\|$1";
push (@subcats, $subcat);
$number = 1;
}
}
next LINE;
}
close REAL;

the catindex looks like the following
1|Club_Scene/Clubs/Europe|Europa

this works fine, but now i've a big problem:
if i had a line like this
1|Club_Scene/2/Europe|Europa

the: if ($1 ne /$my_path\/.+\/.+/) {...
ignores the '2' an think Europa is a subcategory of Club_Scene

what should i do?
did you know?

------------------
www.ford-network.at