So now i'm expereincing something new....it appears related to the || do.....

#!/tps/bin/perl $logfilename = './test.log'; open (my $FH, '>', $logfilename) || die "CANNOT OPEN LOG"; print "\n\noutside FH\n\n"; select $FH; print "\n\n this is inside the FH\n\n"; select STDOUT; print "\n\n this is back outside the FH\n\n"; close($FH); $logfilename = './test2.log'; open (my $FH, '>', $logfilename) || do { print "test test test\n"; die "CANNOT OPEN LOG"; } print "\n\noutside FH\n\n"; select $FH; print "\n\n this is inside the FH\n\n"; select STDOUT; print "\n\n this is back outside the FH\n\n"; close($FH);

when i run this just the first portion of it, before the second open file, select works fine. but when i instate the second open statement with the || do, i am given this error:

syntax error at test.pl line 34, near "print"

is there something wrong with my syntax or does do have some unintended consequence on output redirection? thanks


In reply to Re^2: Multiple actions triggered by failure to open a file by GreenLantern
in thread Multiple actions triggered by failure to open a file by GreenLantern

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.