I have a problem
I am trying to take lines in a text file that look like this. although
there are 500 more or so (and they have more realistic names)

25727   dude, some   M MEX.AMER.  DORM1
25797   dude, other     M BLACK      DORM2
29291   guy, random    M BLACK      DORM3
30249   fella, helluva   M BLACK      DORM4
31139A  brother, notmy   M CAUC       DORM5

Which is essentially, a student Id, last, first, sex, race, etc…..

I am trying to use the following code to make the student id the key
and the whole line the value (including the student ID that I am using
as the key)

So, an example would look like this on paper

       Key:                                    Value:
$student{25727} =                 25727   dude, some   M MEX.AMER.
DORM1

And so on

This is the code I’ve tried…

my %longz;

while (<IFILE>) {
    chomp;
        ($ya,$rest) = split(/^\s+/,$_);
     $longz{$ya} = $rest;
      }


My hope is to create a hash that I can use the student ids from
another list, and if that id is present in the other list to print the
value somewhere else.
However, I have the comparison code down… I think.

My problem is the silly split on the $_ as it goes through the while
loop…

Hope this makes sense.

Keep in mind
The machine I am doing this on is not online, and it is a windows
machine. So I am using Activeperl with only the modules that come with
it.

Help..



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


Reply via email to