Re: modifying strings that contains numbers

2001-10-29 Thread Andrea Holstein
Wagner-David wrote: >> I have an variable of the following format >> >> $i = "buy 10/23/01 50 25.25 50 25.25" >> >> Now, I would like to multiply the 3 and 4th fields by a factor (say 2) >> so I get the following >> >> $i = "buy 10/23/01 100 50.50 50 25.25" > > Here is one way: > > $i

RE: modifying strings that contains numbers

2001-10-28 Thread Wagner-David
Here is one way: $i = "buy 10/23/01 50 25.25 50 25.25"; my @MyItems = split( /\s+/, $i ); $MyItems[2] *= 2; $MyItems[3] *= 2; my $MyPrnt = join(' ', @MyItems); printf $MyPrnt . "\n"; prints: buy 10/23/01 100 50.5 50 25.25 Wags ;) -Original Message- From: Roy Peters [mailto:[EM