Hi all,

am struggling with this, and it must be the something simple but for the life of me I 
don't see it.

Am trying to build a hash table with:
instructor name and their biography

I've tried just about everything, but I can't get the values to show...

where am I going wrong?

thanks, Pam

snippet:
#!/usr/bin/perl -w
use strict;

open(BIOS, "instructor.txt") or die ("no instructor file:  $!");


build_hash();


sub build_hash{
        my ($line, @name, @words, $key, $value, $name, $words);
        my %hash = ();

        while(<BIOS>){
                chomp;
                if ($_ =~ /^[A-Z]{3,3}/){ #an instructor name
                        $name = $_;
                        $name =~ s/[ ]+$//; #remove trailing whitespace
                        print("N: $name\n");
                        
                }
                elsif ($_ !~ "XX"){
                        $words = $_;
                        $words =~ s/[ ]+$//; #remove trailing whitespace
                        print("W: $words\n");
                }
                
                $hash{$name} = $words;
                

        }

        foreach (keys %hash){
                print("HN: $_\n");
        }


        foreach (values %hash){
                print("HV: $_\n");
        }

} #end build_hash

close BIOS;


sample data:
VIRGINIA ABASCAL 
,  M.A., is a freelance director and has directed more
than 40 plays in theaters including Theatreworks, San Jose State Company, Asian 
American
Theatre Company, Speakeasy Theatre, and Theatre Artists of Marin, where she was 
resident
director for eight years, working with new plays. She has won Critics Choice, Bay Area 
Critics
Circle, and Dean Goodman production awards.
XX


GENE ABBOTT
, M.A., has worked in vocational and adult education since
1973. He has been department chair, lead teacher, mentor, and consultant, and is 
program
manager for the Marin County Regional Occupational Program. He has taught in adult 
education,
community college, and ROP. He has lectured throughout California on the topic of
&quot;Thinking Curriculum in Technica Education.&quot;
XX

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

Reply via email to