in reply to Removing Commas and Period in Amount Field

$amount =~ s/[.,]//g;

If you only want digits: s/\D+//g;

Replies are listed 'Best First'.
Re^2: Removing Commas and Period in Amount Field
by drodinthe559 (Monk) on Feb 10, 2009 at 22:12 UTC
    Great that worked. Here's another question. How can I pad a variable with zeros going from right to left? I used chomp on the sub string but it removes the values. Anyone have any ideas?
    my $checknum = "0000000" . substr($source, 18, 12);
    Thanks, Dave
      Maybe this is what you're looking for:
      # left-pad with zeros, total length of 21 my $checknum = sprintf("%021d", $source);

      See sprintf.