From raw 319 $2 is the nick that you whois'd.

Can you supply more of the code, such as everything from the (presumably) while loop that uses %a for the channels?

I suspect that your problem is actually there, than in the code section you supplied.

As a quick write, something like this would work. Note: This may or may not fit in with your current code (I'm suspecting not, as you reference $numeric)

Code:
raw 319:*:{
  var %a = 1, %b = $comchan($2,0)
  while %a <= %b {
    did -s Whois 25 $didwm(Whois,25,$comchan($2,%a))
    inc %a
  }
}