in reply to only want numerics in field

BTW, a tangential point: The loop

while ( $amount2 =~ / / ){ $amount2 =~ s/ //g; }
conditionally does a substitution to remove all spaces if a space is found in a string. However,  s/ //g on its own will never do anything if a match is not found. You are essentially doing one match for the price of two. You can profitably lose the loop (but take the substitution).