
Three Operand Conditional Operator
Quote:
>I would like to do something like the following but get a syntax error.
>print ((1?OUT1:OUT2) "The expression was true\n");
And thanks to Raymond Chen and Randal L. Schwartz I now know that I need to do
something like this:
$outfile = $count % 2 ? OUT1 : OUT2;
print $outfile "random output text.\n";
This is due to the fact that print and printf expect to see a filehandle and
not an expression that ultimately results in a filehandle. Makes enough sense
to me.
Thanks guys.
Just another C hacker converting to Perl,