Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Reading in data that is

by gbarr (Monk)
on Oct 10, 2001 at 20:15 UTC ( [id://118033]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-24 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found