Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Something is defined when it shouldn't be?

by Kenosis (Priest)
on Nov 30, 2012 at 23:34 UTC ( #1006535=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Something is defined when it shouldn't be?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006535]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-10-23 21:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (129 votes), past polls