Thanks, that works.
The only other gotcha I had (which took 5 seconds to figure out - just
for archival) was:
my $clen = length($color);
.
substr($line, $ereg->[0][$enum], 0, $color);
substr($line, ($ereg->[1][$enum] + $clen), 0, "\e[0m");
On Fri, Oct 4, 2013
On Fri, 4 Oct 2013 11:40:48 -0400
shawn wilson wrote:
> foreach my $ereg (@$match)
> {
> my $enum = ($#{$ereg->[0]} >= $#{$ereg->[1]} ?
> $#{$ereg->[0]} : $#{$ereg->[1]});
> print "ereg " . Dumper(@$ereg);
> print "blah " . $ereg->[0][0] . "\n";
> # Each match
> foreach my $i (0 .
I had to sleep on it and then the solution was stupidly obvious (as I
knew it would be).
However, now I'm having the problem I didn't think I would have - the
ANSI sequences are showing up as printable (as well as taking some
effect) in the print. However the escape that should turn the text
back
shawn wilson wrote:
>From position 0 to 7 should be whatever GREP_COLOR export is defined
>as. There might be issues with how I'm doing that but my main issue (I
>think) is how I'm looping (and/or how I'm using substr).
>
>#!/usr/bin/perl
>
>use strict;
>use warnings;
>
>use Data::Dumper;
>
>my $l
>From position 0 to 7 should be whatever GREP_COLOR export is defined
as. There might be issues with how I'm doing that but my main issue (I
think) is how I'm looping (and/or how I'm using substr).
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $line = 'foo bar baz ball';
my $ma