Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Get three values with an foreach

Quote Reply
Get three values with an foreach
May someone can change this to an easier way, plz ?

Code:
my @cats = $cat_db->select (['Full_Name','Name','Number_of_Links'], { FatherID => $id })->fetchall_list;
my ($output, $url);
my $count = '0';
foreach my $cat(@cats) {
if ($count eq '0'){
$url = $cat_db->as_url($cat);
}
elsif ($count eq '1'){
$output .= qq~<a href="$url">$cat</a>~;
}
elsif ($count eq '2'){
$output .= qq~ ($cat)<br>~;
}
$count++;
if ($count eq '3') {$count = 0};
}




Robert
Subject Author Views Date
Thread Get three values with an foreach Robert 2147 May 8, 2002, 2:45 AM
Thread Re: [Robert] Get three values with an foreach
Paul 2078 May 8, 2002, 3:05 AM
Post Re: [Paul] Get three values with an foreach
Robert 2060 May 8, 2002, 4:49 AM