#!/usr/bin/perl -w use strict; my @bucks = ('$1,999,003 USD ', '$1,532.33 AUS', '$1,500.11 USD'); foreach my $amount (@bucks) { next unless $amount =~ m/USD/; my ($comma_amount) = ($amount =~ /\s*\$([\d,.]+)/); print "c=$comma_amount\n"; (my $number = $comma_amount) =~ s/,//g; print "n=$number\n"; } __END__ prints: c=1,999,003 n=1999003 c=1,500.11 n=1500.11