my $rb = $ssl->read(16384); ssl_check_die("SSL read"); if(undefined($rb) or length($rb) <= 0){ unless($! eq "Resource temporarily unavailable"){ ## Here we are done - do whatever is necessary to ## shutdown select dispatcher and close sockets, release ## ssl and context } if($rb){ ## you have read some data in $rb -- do something with it } }