PerlRob has asked for the wisdom of the Perl Monks concerning the following question:
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(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pass conditions to a subroutine
by ikegami (Patriarch) on May 13, 2008 at 17:37 UTC | |
by Fletch (Bishop) on May 13, 2008 at 19:15 UTC | |
by PerlRob (Sexton) on May 13, 2008 at 18:08 UTC | |
|
Re: Pass conditions to a subroutine
by pc88mxer (Vicar) on May 13, 2008 at 17:37 UTC | |
|
Re: Pass conditions to a subroutine
by dragonchild (Archbishop) on May 13, 2008 at 17:38 UTC |