Here is another set of my final assignment
This is my final assignment.
I have been given a fixed length employee list below.
ABAD, RACHEL PR CLERK ENGINEERING ENGR DIST OFC (818) 374-7538
ABDULLAH, SOLOMON SAFETY ENGR PRESS VES INSPECTION (818) 374-9930
ABEL, DARLA SR SAFETY ENG ELEVATORSINSPECTION (213) 202-9839
ABRAHAM, TERESA SR MGMT ANALYST II RES MGMT CUST (213) 482-6766
ABRAMYAN, DANIEL INACTIVE NONE NONE
ABREU, JAMES BUILD MECH INSPECTORCODE ENFCMNT (818) 374-9862
ACEVEDO CASTRO, MECH ENGRG ASS ENGINEERING (213) 202-9902
ACOSTA, JESUS GEOTECH ENGINEER II INSPECTION GRADING (213) 482-6967
AGHAZARIAN, SAKO SRBUILD INSPECTOR INSPECTION BLDG(213) 482-0372
Also I have been given a second list of phone numbers, which happen to be on the list of employee list.
(818) 374-9930
(213) 202-9902
(213) 482-0373
(818) 374-7538
If there is a match, I need to extract and printout the entire line (to another file) but for now I am testing check to ensure am able to read the hash..
!/usr/bin/perl
use strict;
use warnings;
open PHONELIST, "< PHONELIST.TXT" or die "could not open PHONELIST.TXT\n";
my $phone_no;
while (<PHONELIST>) {
chomp;
$phone_no->{$_} = 1;
print "$phone_no\n";
}
close PHONELIST;
open EMPRECORD, "< EMPRECORD.TXT" or die "could not open EMPRECORD.TXT\n";
while (<EMPRECORD>) {
chomp;
my ($phoneKey) = ($_);
if (defined $phone_no->{$phoneKey}) {
print STDOUT "$_\n";
}
}
close EMPRECORD;
I am unable to create the hash to read and compare. Please advise what I am doing wrong.