in reply to splitting and joining a network message

You are using join wrong. Join's args are (first) the new delimiter, and (second) the list of strings being joined. I think that you probably don't even want join at all, you probably (based on your existing code) simply want concatenation as follows:

if( $tmp > 0 ) { $sip_response .= "$line\n"; }

Also notice the use of '>' instead of 'gt'. 'gt' is for strings, and '>' is for numbers. Your use of 'gt' works for you, but only by virtue of the fact that Perl considers any non-empty, non-zero string to be "true".

Additional thought:
An easier way to do the whole thing is probably something like this:

my $sip_response = $response; # Make a copy of the response. if( $sip_response =~ s{^[^\n]+}[200 SIP/2.0 OK] ) { print $sip_response; } else { die "Didn't understand the response: $response\n"; }

...just a thought...


Dave