Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Complete the script to create a hash slice which is a hash keys whose correspond

ID: 3705637 • Letter: C

Question

Complete the script to create a hash slice which is a hash keys whose corresponding values are assigned to another list of keys. Assume that you are working on a student records: (25 pts.) xstudent ID 123456789 NAME Robert Smith SSN "518-18-5454 Do5/19/96 )i update auSavannah 9123584788 engineerin gesavannahstate.edu): gnash slice for crTY, PHONE, LMA?L priet the bash-slice 4) Complete the seript to accomplish the following tuasks using Perl built-in fupctions (10pts) %friends-( "Dallas". "Exeter, "Reading Cary Lucy lan Samantha Oregon" Eva Julia "Deven". Tokyp" a) Priot orly the keys from the hash

Explanation / Answer

first question is not clearly visible ... rest answers are given below ...jhope you find it helpful

4(a)(b)(c)

#Program in Perl to print keys , values & both from a given hash
my %friends = (
    'Gary' => "Dallas",
    'Lucy' => "Exeter",
    'IAN' => "Reading",
    'Samantha' => "Oregon",
    'Eva' => "Deven",
    'Julie' => "Tokyp"
);
# to print only keys 4(a)
print " keys####### " ;
while( my( $key, $value ) = each %friends ){
    print "$key ";
}

# to print only values 4(b)
print " values##### " ;
while( my( $key, $value ) = each %friends ){
    print "$value ";
}
# to print both keys and values 4(c)
print " keys:values#### " ;
while( my( $key, $value ) = each %friends ){
    print "$key: $value ";
}

##########################################################

5) considering that the text file "hello.txt" contains multiple messages in different lines . so the given script will print the messages from text file line by line .

# program starts

use strict;
use warnings;

my $file = 'hello.txt';
open my $info, $file or die "Could not open $file: $!";

while( my $line = <$info>) {
    print $line;

}

close $info;

##########################################################

6) considering that "hello.txt" contains all your data ...the given script changes it into alphabetical order and then prints it

# program starts

open(FH,'<hello.txt') or die "$!";
my @lines = <FH>;
close(FH);
@lines = sort @lines;
print @lines;

#############################################################

7) To delete the first and last line of any given text file and prints the output in the new file ;

###########################################################

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote