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 instances of a
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)/bx;1$1ba/g;
print $s;
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)/bx;1$1ba/g;
print $s;
I get
bx;1144 cmba
what do you get?
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)/bx;1$1ba/g;
print $s;
I get
bx;1144 cmba
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)/bx;1$1ba/g;
print $s;
I get
bx;1144
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)/bx;1$1ba/g;
Input string: 144 cm
Output string: bx;114bx;14 cmbaba
Why
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 cm together by changing it to bx;121 cmba.
My problem
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 cm
Well, that kinda worked. I had to change it to work on a scalar so this
is what I wrote:
$s=~s/(\d+ +cm)/bx;1$1ba/g;
Input string: 144 cm
Output string: bx;114bx;14 cmbaba
Why did I get duplicate bx;1 and ba strings?
Is the \G operator here and does v5.6.1 have it?
Chuck
--
To
D. Bolliger schreef:
#!/usr/bin/perl
use strict;
use warnings;
while (DATA) {
s/(\d+\s+cm)/bx;1$1ba/g;
print;
}
__DATA__
54 x 34 x 30-3/4 Hl137 x 86 x 78 cmlKneehole Height: 24-1/2`` (62
cm)lChair height: 30-3/4 (78 cm)l
If cm can be wrapped to the next line, either slurp or use
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)/bx;1$1ba/g;
Input string: 144 cm
Output string: bx;114bx;14 cmbaba
Why did I get duplicate bx;1 and ba strings?
Hm, I can't reproduce this
11 matches
Mail list logo