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

Can someone help with this Perl assignment? Create a perl script named lab11.pl.

ID: 3723423 • Letter: C

Question

Can someone help with this Perl assignment?

Create a perl script named lab11.pl. The script must perform the following: 1. Ask the userortheir first name and store the value in a variable 2. 3. 4. 5. 6. Ask the user for their last name and store the value in a variable Ask the user for their home town and store the value in a variable Ask the user for the current temperature and store the value in a variable Display the values in these variables back to the screen in a readable manner. The script must be executable by simply running the file itself. 8 Part 2.ArranYS

Explanation / Answer

# taking user input for first name
print "Enter first name: ";
my $first_name = <STDIN>;
chomp $first_name;

# taking user input for last name
print "Enter last name: ";
my $last_name = <STDIN>;
chomp $last_name;

# taking user input for home town
print "Enter home town: ";
my $home_town = <STDIN>;
chomp $home_town;

# taking user input for current temperature
print "Enter current temperature: ";
my $temp = <STDIN>;
chomp $temp;

# printing output
print "First name is $first_name ";
print "Last name is $last_name ";
print "Home town is $home_town ";
print "Current temperature is $temp ";

Sample Output

Enter first name: Chegg
Enter last name: India
Enter home town: NYC
Enter current temperature:10
First name is Chegg
Last name is India
Home town is NYC
Current temperature is 10

# taking user input for first name
print "Enter first name: ";
my $first_name = <STDIN>;
chomp $first_name;

# taking user input for last name
print "Enter last name: ";
my $last_name = <STDIN>;
chomp $last_name;

# taking user input for home town
print "Enter home town: ";
my $home_town = <STDIN>;
chomp $home_town;

# taking user input for current temperature
print "Enter current temperature: ";
my $temp = <STDIN>;
chomp $temp;

# printing output
print "First name is $first_name ";
print "Last name is $last_name ";
print "Home town is $home_town ";
print "Current temperature is $temp ";

Sample Output

Enter first name: Chegg
Enter last name: India
Enter home town: NYC
Enter current temperature:10
First name is Chegg
Last name is India
Home town is NYC
Current temperature is 10