in reply to Reading in data that is
You seem to be going to great lengths to read the file line by line, but the recontruct a single string only to split it back up again.
Why not keep the lines separate to start with? for example
while(<DATA>) { chomp; last if /^"EOS"$/; push @data, $_ }
Also, in your output code you call split with no arguments. That will split $_ on whitespace. But from what you are expecting as output that is not what you want. It would seem that your fields are contained within pairs of "'s so you could just do
my($first_name,$last_name,$address,$city,$state,$phone) = /"([^"]*)"/g
Which will pick out each the strings between " pairs
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Reading in data that is
by basicdez (Pilgrim) on Oct 11, 2001 at 19:38 UTC |
In Section
Seekers of Perl Wisdom