How to get user input in perl

Perl is one of the most used scripting language. Often there is a need to perform certain operations based on user input. Here is the code snippet how to take input from user in perl:

#! /usr/local/bin/perl

print "Enter your name: \n";
$name=<stdin>;
print "\n Hello $name. Welcome to PERL..!! \n";

Let say user provides the input as “David”, output of the above code snippet would be:

Enter your name:
Hello David. Welcome to Perl..!!

  1. I feel this is among the most vital info for me. And i’m happy studying your article.
    But wanna commentary on some general issues, The site taste is wonderful,
    the articles is actually great : D. Good process, cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">