On Tue, Aug 14, 2001 at 01:16:34PM -0500, Jay Strauss wrote:
> Unfortunately, I don't understand the error, or how to solve it
> 
> [jdedev]/home/jstrauss/bin> cat ./tmp
> #!/usr/bin/perl
> @s = ('initial 256','initial 512','initial 1024','initial 2048');
> 
> foreach (@s) {
>         s/(?<=initial\s+)(\d+)/$1 == 256 ? "4092" : "1024" /e;
>         print "$_\n";
> }
> 
> [jdedev]/home/jstrauss/bin> ./tmp
> Variable length lookbehind not implemented before HERE mark in regex
> m/(?<=initial\s+)(\d+) << HERE / at ./tmp line 14.

Hrm.  Sorry, my mistake.  Try this.

s/(initial\s+)(\d+)/ $1 . ($2 == 256 ? "4092" : "1024") /e;

The error meant that lookbehinds (the (?<=foo) thing) have to have a
constant length - no * or +.

Micah

Reply via email to