I haven't used Net::IRC, but from my quick look through the documentation, it looks as if it's all event-based, like a lot of IRC software I've seen. Given that, what you'll need to do is set up an event handler for when your 'whois' command returns before sending the command. The sequence will go something like this:
- You create and register an event handler.
- You send your 'whois' command.
- The server responds, and Net::IRC calls the handler that you registered.
- The handler can then look at the response and do something useful.
I don't know for sure, but I wouldn't be surprised if there are separate types of events for when a user is online and when the server responds that there's nobody here by that nick.