David Gilden wrote: > > Thanks for all of the help, > > Here is what I am currently going with: > > my $prices = '../paul_s/data/prices.txt'; > > open (FH,$prices) || die "could not open $prices $!"; > > while( <FH> ) { > s/^\s*(.+)\s*$/$1/; # clean the front of each line > next if /^\s*$/; # skip blank lines > my ( $k, $v ) = split /\s*,\s*/; # cool use of split > $v =~ s/^\s*(.+?)\s*$/$1/; # clean the value > $prices{qq($k)} = $v; > } > > close FH; > > ######## > > "John W. Krahn" <[EMAIL PROTECTED]> suggests, > > > my %prices = do { local $/; <FH> =~ /[^\n,]+/g }; > > Nice and compact, but how does one remove spurious white space?
%prices = do { local $/; <FH> =~ /\s*([^,]*?)\s*,\s*(.+?)\s*/g }; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]