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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |