in reply to How to replace 'goto' by another construct?
To get a bit more concrete, here are some bits and pieces of your code rewritten:
and instead of the goto OUTER (a similar improvement can be made for goto INNER):open TESTCASE, "imp2.txt" or die $!; chomp(@array = <TESTCASE>); open CONFIGFILE, "imp1.txt" or die $!;
if (...) { $incr++; sendMessage(); } # ... { my $msg = <<END; REGISTER sip: 36.212.176.07 SIP/2.0\r Via: SIP/2.0/UDP 36.212.176.90:5060; branch= z9hg4bk340\r ... END sub sendMessage { print "\nSending message:$msg"; $MySocket->send($msg); } }
-- Hofmator
Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|