William Martell <[EMAIL PROTECTED]> wrote:
:
: I am trying to get this code to write the variables in
: a specific order, even if they are undefined or blank.
: I would like each row seperated by newline.

    What is a row? What specific order?


: I am running into a problem with the scope of the 
: variable being limited to the block of code it is in.
: 
: Can anyone help.

[snipped useful code and data]


    It looks like you want to extract certain fields
from certain lines of a text file. Once you have the
correct fields, what are you going to do with them?

    Another way to ask the question might be: What
data structure would be easiest for you to use when
the field extraction from the text file is complete?

    Here's a three ad example using an Array of
Hashes.

(
    {
        price           => 725,
        bedrooms        => 3,
        bathrooms       => 1,
        living_areas    => undef,
        phone           => '972-289-2098',
        address         => undef,
        location        => 'Mesquite',
        paper           => 'The Dallas Morning News',
        date            => '04/08/2004'
    },
    {
        price           => 950,
        bedrooms        => 3,
        bathrooms       => 1,
        living_areas    => undef,
        phone           => '469-525-0204',
        address         => '1620 Summitt',
        location        => 'Mesquite',
        paper           => 'The Dallas Morning News',
        date            => '04/08/2004',
    },
        price           => 1100,
        bedrooms        => 4,
        bathrooms       => 2,
        living_areas    => 2,
        phone           => '214-566-6106',
        location        => 'Mesquite',
        paper           => 'The Dallas Morning News',
        date            => '04/08/2004',
    {
)

    From this data structure I can sort on any field
(or multiple fields). I can present only certain
fields or do a search on a field.

    Don't worry about how we are going to convert the
text file to this data structure just concentrate on
what structure would be easiest for you to use and
tell us what it looks like.


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to