Thanks Micah,
This is perfect, because now I can call a subroutine to determine the
substitution value.
Thanks again
Jay
----- Original Message -----
From: "Micah Cowan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 14, 2001 2:56 PM
Subject: Re: [vox-tech] Perl: Regex if then else
> 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
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com