Inside a script I have the folllowing code:
@cats = split(/\|/, $infodata[1]);
$catline = "";
$caturl = "";
foreach $pcats(@cats) {
$catline .= "$pcats, ";
$caturl = qq|<A HREF=\"$pcats.html\">$catline</A>|;
}
chop($catline);
chop($caturl);
The cats @cats are a string seperated by commas like so - auto, truck, power-sports, motorsport, etc., Right now it is returning the last cateogry in the string e.g. <A HREF="motorsport.html">thestring</A> but instead I want it to print out each cat by splitting it at the comma and then spit out the corresponding URL.
Thanks for your help.
@cats = split(/\|/, $infodata[1]);
$catline = "";
$caturl = "";
foreach $pcats(@cats) {
$catline .= "$pcats, ";
$caturl = qq|<A HREF=\"$pcats.html\">$catline</A>|;
}
chop($catline);
chop($caturl);
The cats @cats are a string seperated by commas like so - auto, truck, power-sports, motorsport, etc., Right now it is returning the last cateogry in the string e.g. <A HREF="motorsport.html">thestring</A> but instead I want it to print out each cat by splitting it at the comma and then spit out the corresponding URL.
Thanks for your help.