my $i = 0; my $count = 0; my $counts = ''; foreach $quote (@quotes) { if($quotes[$i]->{'author'} eq $args[1]) { $count++; $counts = $counts.$i."::"; } $i++; } if($count > 0) { my $rand = rand(int($count-1)); my @counters = split(/::/, $counts); $conn->privmsg($settings{'home'}, "[".$quotes[$rand]{'author'}."] ".$quotes[$rand]{'quote'}); return; } $conn->notice($nick, "There are no quotes by that nickname."); return;