in reply to While(1) using 100% CPU
You're telling select to timeout immediately, causing it to be called over and over again. You presumably wanted to tell it to never timeout. As documented, this is done by not specifying a timeout.
IO::Select->select($read_set, undef, undef, 0)
should be
IO::Select->select($read_set, undef, undef) (documented)
or
IO::Select->select($read_set, undef, undef, undef) (undocumented)
By the way, since the write and error objects aren't specified, you can simply use can_read.
$read_set->can_read()
|
|---|