saunderson has asked for the wisdom of the Perl Monks concerning the following question:
i wonder whether it's possible to simplify constructs like
further, such that i have to write the variable ($test) only once!? I often have to deal with such statements and i just don't want to use perl's default variable, so that it yieldsdoSthWith($test) if checkFn($test);
since $_ is often used by other statements in the same block.$_=$test; doSthWith($_) if checkFn($_);
How would you monks do it the neat way?
best regards
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: variable processing and checking in one statement (for my)
by tye (Sage) on Aug 07, 2012 at 00:13 UTC | |
by saunderson (Novice) on Aug 07, 2012 at 00:29 UTC | |
|
Re: variable processing and checking in one statement
by BrowserUk (Patriarch) on Aug 06, 2012 at 22:26 UTC | |
|
Re: variable processing and checking in one statement
by ig (Vicar) on Aug 07, 2012 at 04:37 UTC |