in reply to printing LAST_MATCH_START/@- LAST_MATCH_END/@+ array where regex match begin/end
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11139917 use warnings; while( <DATA> ) { my @pos; push @pos, @-, @+ while /\t+/g; @pos or @pos = (-1) x 2; print "@pos\n"; } __DATA__ foo bar baz foo bar foo baz ccc ddd foo bar foo baz ccc ddd foo bar baz foo bar foo baz ccc ddd foo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: printing LAST_MATCH_START/@- LAST_MATCH_END/@+ array where regex match begin/end
by perl_boy (Novice) on Dec 29, 2021 at 13:59 UTC | |
by tybalt89 (Monsignor) on Dec 29, 2021 at 22:07 UTC |
In Section
Seekers of Perl Wisdom