use strict;
use warnings;
####
while($_=~m/\<(.+?)\>(.+?)\<\/\1\>/sig)
####
#!/usr/bin/perl
use strict;
use warnings;
print "This will calculate the total amount and number of transactions.\n";
my $totalamt = 0;
my $cnt = 0;
my @amounts = ();
while()
{
chomp;
@amounts = /\(\d+(?:.\d{2})?)\<\/payment amount\>/sig;
foreach my $amt (@amounts)
{
$cnt++;
$totalamt += $amt;
}
}
print sprintf("The total amount found is \$%.2f\n",$totalamt);
print "Total no. of transactions: $cnt\n";
__DATA__
68789790390909090489
MTRIN10909890896
700000
9033753053985392INR
938573895735154
1222706
9284723472047222INR
RP JLLKL7687
9284723472047222INR
RP JLLKL7687
1437865.95
9284723472047222INR
RP JLLKL7687
this is garbage
9033753053985392INR93857389573515412227069284723472047222INRRP JLLKL76871437865.95