*imagine IO::Socket, IO::Select code here* .. $line = ; chomp($line); parse_command($line); .. sub parse_command { my ($data) = @_; .. if($data =~ /^tell (.+?)\@(.+?) (.+)$/) { @args = ($2, 'tell', $1, $3); } .. if(@args) { $i2->send(@args); } } .. sub send { my ($me, $dest, $request, @params) = @_; .. if($dest ne 'all' && !defined($testmud = $me->getMudName($dest))) ... }