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:[EMAIL PROTECTED]]
Sent: Sunday, October 28, 2001 14:47
To: [EMAIL PROTECTED]
Subject: modifying strings that contains numbers
hi
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"
How do I do this?
Thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]