#!/usr/bin/perl use warnings; use strict; ##################### # configuration section ##################### my $readfrom = "test.txt"; ## change the above to the file you're reading from my $writeto = "output.txt"; ## change the above to the file you're writing to ##################### # do not edit below this line ##################### $/="====\n\n"; open (READFROM, "$readfrom") or die "Cannot open $readfrom: $!"; open (WRITETO, ">$writeto") or die "Cannot open $writeto: $!"; while ( ) { chomp; ## doesn't work # my $phone; # if (m|[(]?(\d{3})[. )-][ ]?(\d{3}\d?)[. -](\d{4})|g) # { # $phone = "$1 $2 $3"; # } # print "$phone\n"; ## $_ =~ m/(\$([0-9,?])+)\s/; my $price = $1; print "$price\n"; } close (WRITETO) or die "Cannot close $writeto: $!"; close (READFROM) or die "Cannot close $readfrom: $!";