in reply to scoping question
Generally, however, this wouldn't be a very sound approach, as it is usually very easy to loose track of the $_ variable. Although, it does spare you having to declare variables, especially for short code blocks or loops.if ( $_ = $obj->get_id() ) { # use $_ inside this block... $obj->do_this(); } elsif ( $_ = $obj->create_id() ) { # use $_ inside this block $obj->do_that(); } else { $obj->do_somethingelse(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: scoping question
by ikegami (Patriarch) on Mar 02, 2006 at 16:47 UTC |