#!PERL.EXE -w
use strict;

print "Enter the price not necessarily in the format of \"\$123.45\" (^Z to quit)\n";
while (1) {
    print "\n\n> ";
    my $line=<STDIN>;
    $line or last; #   unless ($line) { last; }
    chomp($line);

    # $i              12         3
    if ( $line =~ m/\b(([0-9]+)\.([0-9]{2}))\b/ )
    {
        print "EXTRACTED: number $1 which is $2 dollars and $3 cents";
    }
    else
    {
        print "WRONG PRICE FORMAT!\n";
    }
}