Monosex is correct here, get your script to whois them and work from raw 307
If you are an oper you still can't work with an identifier, you have to /mode <nickname> then load the result into a variable from raw 324 (as Monosex said - if your IRCd supports it) and work with that.