http://www.perlmonks.org?node_id=1006535


in reply to Something is defined when it shouldn't be?

The following merely builds upon choroba's mentioning of using a regex to detect digits in the two price variables:

use strict; use warnings; ... my ($part_number, $part_desc, $company1_price, $company2_price) = (spl +it /\t+/, $row )[0,1,3,5]; next unless $company1_price =~ /\d/ and $company2_price =~ /\d/; $company1_price =~ s/\s+//g; $company2_price =~ s/\s+//g; print $company1_file, "$part_number\t$part_desc\t$company1_price\n"; print $company2_file, "$part_number\t$part_desc\t$company2_price\n"; ...

Additionally, both prices are cleared of any spaces, in case there are any.