print "Input a string :"; $_ = ; chomp($_); if (/^(\$)*(0|[1-9][0-9]{0,2}(,[0-9]{3})*)(\.[0-9][0-9])?$/){ print "valid quantaty\n"; }