In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
>
> > My first post in this thread shows example data as it is stored in a
> > scalar variable. It also shows what the string SHOULD look like after
> > the substitution.
> >
> > Or maybe, perl simply is not able to replace multiple in
C.R. am Dienstag, 31. Oktober 2006 17:20:
> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
>
> > You need to show us your code Chuck. Perl doesn't do that, in any
> > situation that I can think of. Try running this on its own:
> >
> > my $s = '144 cm';
> > $s =~ s/(\d+ +cm)/$1/g;
> > pri
On 10/31/2006 10:20 AM, C.R. wrote:
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
You need to show us your code Chuck. Perl doesn't do that, in any situation that
I can think of. Try running this on its own:
my $s = '144 cm';
$s =~ s/(\d+ +cm)/$1/g;
print $s;
I get
144 cm
what do
Chuck Roberts wrote:
>
> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
>>
>> You need to show us your code Chuck. Perl doesn't do that, in any situation
>> that I can think of. Try running this on its own:
>>
>> my $s = '144 cm';
>> $s =~ s/(\d+ +cm)/$1/g;
>> print $s;
>>
>> I get
>>
>
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> You need to show us your code Chuck. Perl doesn't do that, in any situation
> that
> I can think of. Try running this on its own:
>
> my $s = '144 cm';
> $s =~ s/(\d+ +cm)/$1/g;
> print $s;
>
> I get
>
> 144 cm
>
> what do you get?
>
C.R. wrote:
> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> says...
>> C.R. am Mittwoch, 25. Oktober 2006 20:38:
>>> Well, that kinda worked. I had to change it to work on a scalar so this
>>> is what I wrote:
>>> $s=~s/(\d+ +cm)/$1/g;
>>>
>>> Input string: 144 cm
>>> Output string: 144 cm
>
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
says...
> C.R. am Mittwoch, 25. Oktober 2006 20:38:
> > Well, that kinda worked. I had to change it to work on a scalar so this
> > is what I wrote:
> > $s=~s/(\d+ +cm)/$1/g;
> >
> > Input string: 144 cm
> > Output string: 144 cm
> >
> > Why did I
C.R. am Mittwoch, 25. Oktober 2006 20:38:
> Well, that kinda worked. I had to change it to work on a scalar so this
> is what I wrote:
> $s=~s/(\d+ +cm)/$1/g;
>
> Input string: 144 cm
> Output string: 144 cm
>
> Why did I get duplicate and strings?
Hm, I can't reproduce this (perl 5.8.8):
$ per
"D. Bolliger" schreef:
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> while () {
> s/(\d+\s+cm)/$1/g;
> print;
> }
>
> __DATA__
> 54 x 34 x 30-3/4 H137 x 86 x 78 cmKneehole Height: 24-1/2`` (62
> cm)Chair height: 30-3/4 (78 cm)
If "cm" can be wrapped to the next line, either slurp or use
Well, that kinda worked. I had to change it to work on a scalar so this
is what I wrote:
$s=~s/(\d+ +cm)/$1/g;
Input string: 144 cm
Output string: 144 cm
Why did I get duplicate and strings?
Is the \G operator here and does v5.6.1 have it?
Chuck
--
To unsubscribe, e-mail: [EMAIL PROTECTE
C. Roberts am Mittwoch, 25. Oktober 2006 19:32:
> I have Perl 5.6.1 on Sun Solaris.
>
> I am processing a text file which will be imported into our
> typesetting software. In our typesetting software I want to make
> sure a number does not separate from its unit of measure. So I want
> to keep "21
11 matches
Mail list logo