On 08/14/2013 04:22 PM, Jim Gibson wrote:
On Aug 14, 2013, at 12:30 PM, Alexey Mishustin wrote:
Testing a value and assigning it - I have never done this at the same time...
Doing both in while statements is very common:
while( my $line = <$fh> ) {
...
}
Try to write that loop with two separate statements, one an
assignment
and the other an if statement, and you may see the advantage of the
currently-allowed syntax.
The general policy is that assignment statements return a value that
may be further used or tested.
i have a common idiom when dealing with a value in a hash:
if( my $foo = $ref->{foo} ) {
do stuff with $foo
}
uri
--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/