Gents, thanks for your help. Kevin -----Original Message----- From: [EMAIL PROTECTED] [mailto:london.pm-admin@;london.pm.org]On Behalf Of Simon Wilcox Sent: 17 October 2002 14:09 To: London Perl Mongers (E-mail) Subject: Re: RE efficiency question.
On Thu, 17 Oct 2002, Kevin Gurney wrote: > "** TOTALS 5533.86 0.00 0.00 0.00 5533.86 > 0.00 5533.86 0.00 5533.86 5533.86" > > P.S If anyone feels so inclined, a better way of matching the numbers would > be most appreciated as I'm simply picking > everything in a 12 char range each time. unpack is your friend here: [simonw@morpheus perl]$ cat kevin.pl my $test = "** TOTALS 5533.86 0.00 0.00 0.00 5533.86 0.00 5533.86 0.00 5533.86 5533.86"; my @bits = unpack "A9A12A12A12A12A12A12A12A12A12", $test; foreach (@bits) { print $_,"\n"; } print @bits[1] + @bits[5], "\n"; [simonw@morpheus perl]$ perl kevin.pl ** TOTALS 5533.86 0.00 0.00 0.00 5533.86 0.00 5533.86 0.00 5533.86 11067.72 Perl even does the Right Thing [tm] when you try and add two of the numbers together :) Simon. -- "We have normality. Anything you still can't cope with is therefore your own problem"