Question

Write a Perl program that prompts a use to input a line of text. If the line of text mentions bot...

  1. Write a Perl program that prompts a use to input a line of text. If the line of text mentions both John and Smith, the program outputs “FOUND.” Otherwise, it outputs “NOT FOUND.”

  2. Write a Perl program that prompts a use to input a line of text. If the line of text has a word that is capitalized but not ALL capitalized, the program outputs “FOUND.” Otherwise, it outputs “NOT FOUND”. For example, if the user enters “Fred,” the program outputs “FOUND.” But if the user enters “fred” or “FRED,” the program outputs “NOT FOUND.”

  3. Write a Perl program that prompts a use to input a line of text. If the line of text has a two of the same nonwhitespace characters next to each other, the program outputs “FOUND.” Otherwise, it outputs “NOT FOUND.” For example, if the user enters “Mississippi,” “Bamm-Bamm,” or “llama,” the program outputs “FOUND.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

use strict;
use warnings;

print "Enter line please: ";
my $name = <STDIN>;
chomp $name;

if ( $name =~ /\bJohn and Smith\b/ ) {
print "Found\n";
}
else
{
   print "Not Found\n";
}

Answer 2
***********

use strict;
use warnings;

print "Enter line please: ";
my $name = <STDIN>;
chomp $name;

if ( $name =~ /\bFred\b/ ) {
print "Found\n";
}
else
{
   print "Not Found\n";
}

Answer 3
***********

use strict;
use warnings;

print "Enter line please: ";
my $name = <STDIN>;
chomp $name;

if ($name =~ '([a-z]|[a-z])\\1')
{
print "Found\n";
} else {
print "not found\n";
}

if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)

Add a comment
Know the answer?
Add Answer to:
Write a Perl program that prompts a use to input a line of text. If the line of text mentions bot...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Perl program that prompts a use to input a line of text. If the...

    Write a Perl program that prompts a use to input a line of text. If the line of text has a word that is capitalized but not ALL capitalized, the program outputs “FOUND.” Otherwise, it outputs “NOT FOUND”. For example, if the user enters “Fred,” the program outputs “FOUND.” But if the user enters “fred” or “FRED,” the program outputs “NOT FOUND.”

  • Write a Perl program that prompts a use to input a line of text. If the...

    Write a Perl program that prompts a use to input a line of text. If the line of text mentions both John and Smith, the program outputs “FOUND.” Otherwise, it outputs “NOT FOUND.” Please note: If you have already answered this question, don't answer it again. I'm seeking a second opinion.

  • Write a program that takes in a line of text as input, and outputs that line...

    Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH уен Hint: Use the fgets function to read a string with spaces from the user...

  • please use java Write a program that prompts the user to enter line of text (including...

    please use java Write a program that prompts the user to enter line of text (including whitespace). The program then replaces the following vocals with numbers: a = 1, e = 2, i = 3, o = 4, u = 5 and outputs the result to the console. The program does not consider case, so a = 1, A = 1, e = 2, E = 2, etc. Example: Input: Hello, how are you? Output: H2ll4, h4w 1r2 y45? The...

  • Write a program that takes in a line of text as input, and outputs that line of text in reverse.

     4.24 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or 'q" for the line of text. Ex: If the input is: Hello there Hey quit the output is: ereht ollel yeH

  • Write a program in C++ that prompts the user to input the name of a text...

    Write a program in C++ that prompts the user to input the name of a text file and then outputs the number of words in the file. You can consider a

  • Write a program that takes in a line of text as input, and outputs that line of text in reverse.

    Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text.Ex: If the input is:Hello there Hey quitthen the output is:ereht olleH yeHThere is a mistake in my code I can not find. my output is : ereht olleH ereht olleHyeHHow can I fix this?I saw some people use void or the function reverse but we didnt...

  • On question 1-3 can you please answer each script separately. Please Use Perl Scripting 1. write...

    On question 1-3 can you please answer each script separately. Please Use Perl Scripting 1. write a program that computes the circumference of a circle with a radius of 12.5. Circumference is 2π times the radius (approximately 2 times 3.141592654). The answer you get should be about 78.5. 2. Modify the program from the previous exercise to prompt for and accept a radius from the person running the program So, if the user enters 12.5 for the radius, she should...

  • Write a C program that prompts the user for an input string with all lowercase letters....

    Write a C program that prompts the user for an input string with all lowercase letters. Your program should then sort the characters in the string and print the sorted string. Assume that the string contains no spaces and has at most 30 lowercase characters. Your program should loop continually until the user enters “q” to quit.

  • 1. Write a program that prompts the user to enter three integers and display the integers...

    1. Write a program that prompts the user to enter three integers and display the integers in non-decreasing order. You can assume that all numbers are valid. For example: Input Result 140 -5 10 Enter a number: Enter a number: Enter a number: -5, 10, 140 import java.util.Scanner; public class Lab01 { public static void main(String[] args) { Scanner input = new Scanner(System.in);    } } ---------------------------------------------------------------------------------------------------------------------------- 2. Write a program that repeatedly prompts the user for integer values from...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT