if (cond) { ...stuff... } else { #nothing here if (cond2) { ...more stuff... } #nothing here, either } #### if (cond1) { ...stuff... } elsif (cond2) { ...more stuff... } #### while () { if ($ban_gate==1) { if ($_=~/END_BANNER/) { # found end of section, do stuff and turn off section processing $ban_gate=0; } else { # process a line in the banner section } } else { if ($ras_gate==1) { if ($_=~/END_xxxx/) { # found end of section, do stuff and turn off section processing $ras_gate=0; } } else { # process a line in the ras section } } } #### while () { if ($state eq 'BANNER') { if ($_=~/END_BANNER/) { # found end of section, do stuff and turn off section processing $state='-none-'; next; } # process a line in the banner section } elsif ($state eq 'RAS') { if ($_=~/END_xxxx/) { # found end of section, do stuff and turn off section processing $state='-none-'; next; } # process a line in the ras section } }