Why not move the body of the labels into where the goto is?

print "\nClient Started: Ready For Packet To Send:\n"; my $incre = 0; { last if $array[$incr] eq ''; if ($array[$incr] eq "[SEND]") { $incr++; if ($array[$incr] eq ("REGISTER" || "INVITE" || "ACK" || "BYE" || + "OPTION" || "CANCEL")) { $incr++; my $msg=$method; print "\nSending message:$msg"; $MySocket->send($msg); } else { print "Bad Request :$array[$incr]"; exit 1; } } elsif ($array[$incr] eq "[RECV]") { $incr++; if($array[$incr] == (100 || 200 || 300 || 400)) { $incr++; print "Waiting for Response:\n"; $MySocket->recv ($text,1000);#///Recv print "\nReceived message From:$text"; } else { print "Bad Response name:$array[$incr]"; exit 1; } } else { print "Bare word found:"; exit 1; } redo; }

--
Leviathan

In reply to Re: How to replace 'goto' by another construct? by Leviathan
in thread How to replace 'goto' by another construct? by sanjay nayak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.