String eval compiles at runtime and will avoid the error in older perls (you'll have to move the declaration of $mem to avoid a scoping issue).
my $var = ''; my $mem; if($] > 5.007) { if( eval q{open ($mem, '>', \$var) } ) {print "Success\n"} } else {print "Ok\n"}
In reply to Re: Compile time problem
by FunkyMonk
in thread Compile time problem
by syphilis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |