My only offerings for /G and
pos are
this and
this from the
Pattern Finding thread (it does use pos() as an lvalue...).
And for /g, a thing to split up a block of text, preserving existing line breaks, but having a max line size:
print $1,"\n"
while $text =~ /([^\n]{0,$max_line_size}})\n?/g;
Oh, and a '/g'
example from a recent thread (of which you've probably already got something similar).
And this thing which reads from a socket until I have an end-token on a line:
while ($sel->can_read) {
sysread($fh, $buffer, 2048, length($buffer));
next unless $buffer =~ /^(EOT|DONE)$/m;
....(process $buffer)
}