SLNO FirstName LastName Desgination
-----------------------------------------------------
1 Pragya Singh Developer
2 George Shepered SME
3 Akshay Bhargav SME
4 Amey Deshmukh Developer
5 Bhushan Bhatkar Quality
6 Dinesh Yadav Support
------------------------------------------------------
####
#!/perl/bin/perl
$fname = "Designations.txt";
open (WXYZ, $fname) or die "Couldn't open file Designations.txt, $!";
while () {
print "$_";
}
print "Enter First Name or Last Name: \n \n";
$name = ;
print "Entered name is : $name \n";
####
#!/perl/bin/perl
use strict;
use warnings;
my $fname = 'Designations.txt';
open (my $fh, '<', $fname) or die "Couldn't open file $fname, $!";
while (<$fh>) {
print;
}
print "Enter First Name or Last Name: \n \n";
my $name = ;
print "Entered name is : $name \n";
####
#!/perl/bin/perl
use strict;
use warnings;
my $fname = "Designations.txt";
open (my $fh, '<', $fname) or die "Couldn't open file $fname, $!";
my %designation;
while (<$fh>) {
my ($SLNO, $first, $last, $desig) = split /\s+/;
$designation{$first} = $desig;
$designation{$last} = $desig;
}
print "Enter First Name or Last Name: \n \n";
chomp(my $name = );
print "Entered name is : $name \n";
print "Designation is : $designation{$name}\n";