in reply to (Perl 5.10.1 or before)What does $_ refer to here?
foreach ($2..$3) {$breakpoint{$1}{$_}=1;}
Thats the loop var of the foreach.
In this case the regex matches 2 and 3 from the previous line.
If you wanna get rid of it, try:
for my $m ($2..$3) {$breakpoint{$1}{$m}=1;} *
As a side note: Your declaration of $line looks weird, why not directly inside the while condition?
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
*) From perlsyn
The foreach keyword is actually a synonym for the for keyword, so you can use either. If VAR is omitted, $_ is set to each value.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: (Perl 5.10.1 or before)What does $_ refer to here?
by hghosh (Acolyte) on Jun 10, 2019 at 12:50 UTC | |
by Athanasius (Archbishop) on Jun 10, 2019 at 13:32 UTC | |
by LanX (Saint) on Jun 10, 2019 at 13:35 UTC |