hi-

just did some work w/ a pipe-delimited file:

assuming that you've already cleaned the data to make sure that there are
no random pipes in there, something like the following should work:

open(NEW, "$cwd/txt/new.txt") or die "couldn't open new.txt";

while ($line = <NEW>) {
        chomp($line);
        ($usrid, $alias, $passwd, $fname, $mname, $lname) 
                = split /\|/, $line, 6;

        next if (exists $hoh{$usrid});

        $hoh{$usrid} = {
                alias   => $alias,
                passwd  => $passwd,
                fname => $fname,
                lname => $lname,
                mname => $mname,
        };
}

close NEW;

> It's a pipe delimited txt file.
> 
>               -----Original Message-----
>               From:   Kipp, James [mailto:[EMAIL PROTECTED]]
>               Sent:   Tuesday, June 04, 2002 2:15 PM
>               To:     '[EMAIL PROTECTED]'
>               Subject:        RE: Read a file into a Hash
> 
>               how is the file laid out?
> 
>               -----Original Message-----
>               From: Ned Cunningham [mailto:[EMAIL PROTECTED]]
>               Sent: Tuesday, June 04, 2002 2:02 PM
>               To: '[EMAIL PROTECTED]'
>               Subject: Read a file into a Hash
> 
> 
>               I am trying to traverse a file and match the key to a key in
> a second
>               file...
> 
>               How do I put the file into the Hash???
> 
>               %hash = "c:/file.txt"; 
> 
> 
> 
>               -- 
>               To unsubscribe, e-mail: [EMAIL PROTECTED]
>               For additional commands, e-mail: [EMAIL PROTECTED]
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to