A trick for the global matching that I have had occasion
to use in the past.
I was trying to parse a fixed delimited report. But the
locations of the columns was not fixed. However there
was a header, something like this:
Here Be Many Columns
-------- ---------- ---------
To locate the positioning of the columns I found the
line with the underlines and then:
my @space_loc;
while ($line =~ / /g) {
push @space_loc, pos($line);
}
You can also put together a small "parse engine" as a
demo of \G matching. Handling the CSV spec might be a
good example.