my $condition = '!-d $someDir'; my $result = checkForDirectory($condition); sub checkForDirectory { my $condition = shift; # This is where the problem is. I want to interpolate # the text in this variable and use it as my condition. # How can I get Perl to DWIM here? if ($condition) { doSomethingElse(); } }
In reply to Pass conditions to a subroutine by PerlRob
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |