in reply to Compile time problem
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"}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Compile time problem
by syphilis (Archbishop) on Oct 06, 2007 at 15:31 UTC | |
by FunkyMonk (Bishop) on Oct 06, 2007 at 16:09 UTC | |
by shmem (Chancellor) on Oct 06, 2007 at 20:58 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |