in reply to The $_ Special Variable
The more common use of $_ is when it's the default iterator in a for loop, or in a while loop when reading from a file.$_= "Best winkles in Sunderland"; if (/under/) { print "We're talking about rugby\n"; }
# Instead of having for my $iter, for uses $_ as the iterator below: for ("Up and under", "Best winkles in Sunderland") { if (/under/) { print "We're talking about rugby\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The $_ Special Variable
by chuloon (Initiate) on Jun 21, 2011 at 17:52 UTC | |
by ikegami (Patriarch) on Jun 21, 2011 at 17:57 UTC | |
by wind (Priest) on Jun 21, 2011 at 17:58 UTC | |
by chuloon (Initiate) on Jun 21, 2011 at 18:03 UTC | |
by wind (Priest) on Jun 21, 2011 at 18:20 UTC | |
by chuloon (Initiate) on Jun 21, 2011 at 18:32 UTC | |
| |
by chuloon (Initiate) on Jun 21, 2011 at 18:25 UTC |