http://qs321.pair.com?node_id=118033


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
    Thank you for your help. Can you possibly offer me a suggestion as to what I could do if this were the following file.
    "Jane" "Doe" "123 Lover's Lane" 09/22/2001 "Beverly" "CA" "EOS"
    See the 4GL that is creating these packets to be passed back to the interface code is using an export tool that puts "s around character fields and nothing around numberic, decimal or integer fields? I do not mean to be so confused. I am learning a ton and so grateful for any and all help you could offer to me. peace dez l