1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Firdavs [7]
3 years ago
11

Write a perl program that reads from a file containing a list of names and then displays that list to a user. The program should

then ask the user if they want to sign up on the list. If they say yes, then the program should get the name of the user and add it to the file containing the list of names. If the user does not want to sign up then the program should exit.
Computers and Technology
1 answer:
Alekssandra [29.7K]3 years ago
4 0

Answer:

#!/usr/bin/perl

use warnings;

use strict;

my $file = 'File1';

my $name;

my %h = ( ansy => 'Yes', ansn => 'No' );

open(Handle, '>>$file') or die $!;

while(<Handle>){

  print $_;

}

print "Do you want to enter your name ? \n";

my $answer = <STDIN>;

chomp $answer;

print "You have entered input as '$answer' \n" ;

my %h = ( ansy => 'Yes', ansn => 'No' );

if( $answer eq $h{ansy} ) {

  # if condition is true then print the following

  printf "Please enter your name ? \n";

  my $answer1 = <STDIN>;

  chomp $answer1;

  printf "Your have entered '$answer1' and it will be added to list \n";

  print Handle '$answer1';

} elsif( $answer eq $h{ansn} ) {

  # if condition is true then print the following

  printf "You have entered No and we will exit";

  exit();

} else {

  # if none of the above conditions is true

  printf "please enter either Yes or No \n";

}

close(Handle);

Explanation:

Above Code will work as per requirements. File1 is the path of your file.

You might be interested in
Robin ensures that she is always available if anyone in the team needs her. Which quality is shown by robin?
Inessa05 [86]
Helpful, resourceful, friendly, welcoming.
8 0
3 years ago
Read 2 more answers
6, Answer the following questions.0<br>a What is software?​
nekit [7.7K]

Answer:

Software is a set of instructions, data or programs used to operate computers and execute specific tasks. Opposite of hardware, which describes the physical aspects of a computer, software is a generic term used to refer to applications, scripts and programs that run on a device. Software can be thought of as the variable part of a computer, and hardware the invariable part.

Software is often divided into categories. Application software refers to user-downloaded programs that fulfill a want or need. Examples of applications include office suites, database programs, web browsers, word processors, software development tools, image editors and communication platforms.

Explanation:

Software is a set of instructions, data or programs used to operate computers and execute specific tasks. Opposite of hardware, which describes the physical aspects of a computer, software is a generic term used to refer to applications, scripts and programs that run on a device. Software can be thought of as the variable part of a computer, and hardware the invariable part.

Software is often divided into categories. Application software refers to user-downloaded programs that fulfill a want or need. Examples of applications include office suites, database programs, web browsers, word processors, software development tools, image editors and communication platforms.

5 0
4 years ago
A(n application system is the master controller for all the activities that take place within a computer system. _______________
Elenna [48]
The answer is b.false
3 0
3 years ago
How do you suppose a request travels from one computer to another? How does the request know where to go?
Luden [163]
It can request a signal then transfer certain data points and provide the request. The request knows where to go using certain lines in the data.
4 0
3 years ago
How can ascii be used to represent characters in computer system
Furkat [3]

It is a code for representing 128 English characters as numbers, with each letter assigned a number from 0 to 127. For example, the ASCII code for uppercase M is 77. Most computers use ASCII codes to represent text, which makes it possible to transfer data from one computer to another.

7 0
4 years ago
Other questions:
  • Suppose an array with six rows and eight columns is stored in row major order starting at address 20 (base 10). If each entry in
    8·1 answer
  • Prompt the user for an automobile service. Each service type is composed of two strings. Output the user's input. (1 pt) Ex: Ent
    9·1 answer
  • What fields of engineering are in Biomedical
    7·1 answer
  • William found out that someone used his report on American culture without his permission. What is William a victim of?
    8·2 answers
  • The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
    8·1 answer
  • Businesses and sometimes individuals use a _____ to assimilate all of their social media content on a specific topic to engage r
    13·1 answer
  • Who created fortnite
    15·2 answers
  • Write a program to find the principle amount​
    10·1 answer
  • Mack signs into his laptop and gets a message saying all his files have been encrypted and will only be released if he sends mon
    5·1 answer
  • Identify the network and the host address in the ip address of 12.128.120.131 with a subnet mask of 255.128.0.0.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!