in reply to Problem with recv()???

You get that error message, because of this line:

warn "Modbus client : problem with recv: $!\n";

Your code is far too large and badly indented, so I won't bother to track down to which if the else belongs. I guess it belongs to the following lines:

my $from_who = recv( TCP_SOCK, $data, MAX_RECV_LEN, 0 ); if ( $from_who ){

So, you didn't receive anything, or just a bare 0. I don't know what you're actually sending over the wire. Maybe consider printing that out.

Also, I'm not sure whether send and recv make sense for TCP (stream) connections - I'd use normal read and print.

As you claim that your program works on Windows but not on Linux, maybe you also have a problem with differences in how the two OSes buffer things, or not...