If you really want do this (why?:), you can, and without resorting to subs or do blocks--but I wouldn't advise it. T'is fun though:)

#! perl -slw use strict; my @result; sub dofirstcritical { print 'do first critical returning ', $result[ 0 ]; $result[ 0 ] } sub dobackupcritical { print 'do backup critical returning ', $result[ 1 ]; $result[ 1 ] } sub dobackupremainder{ print 'backup remainder done' } sub dofirstremainder { print 'first remainder done' } for my $result ( [ 0, 0 ], [ 0, 1 ], [ 1, 0 ], [ 1, 1] ) { @result = @$result; eval{ dofirstcritical() and ( dofirstremainder(), die 'Exiting 0' ) or ( ( dobackupcritical() or die "main and backup failed" ) and ( dobackupremainder(), die 'Exiting 0' ) ) }; print $@, $/; } __END__ P:\test>temp do first critical returning 0 do backup critical returning 0 main and backup failed at P:\test\temp.pl line 15. do first critical returning 0 do backup critical returning 1 backup remainder done Exiting 0 at P:\test\temp.pl line 15. do first critical returning 1 first remainder done Exiting 0 at P:\test\temp.pl line 15. do first critical returning 1 first remainder done Exiting 0 at P:\test\temp.pl line 15.

Note: The eval block is only there to captiure and record the dies and simulated exits.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

In reply to Re: Nested OR as a control structure by BrowserUk
in thread Nested OR as a control structure by andyf

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.