Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Perl Babysteps 1: Your First Simple Script

by webfiend (Vicar)
on Dec 30, 2004 at 00:10 UTC ( [id://418141]=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
     $ which perl
     /usr/bin/perl
    
  2. or download this
     # hello.pl
     #  - Displays a warm greeting
    
     print "Hello, World!\n";
    
  3. or download this
     # hello.pl
     #  Displays a warm greeting.
    
  4. or download this
     $ perl hello.pl
     Hello, World!
     $
    
  5. or download this
     print "Hello, World!";
  6. or download this
     $ perl hello.pl
     Hello, World!$
    
  7. or download this
     # hello.pl
     #  Displays a warm greeting.
    
     my $name = "Brian";
     print "Hello, $name!\n";
    
  8. or download this
     $ perl hello.pl
     Hello, Brian!
     $
    
  9. or download this
     my $name = "Brian"; # My scalar variable called 'name' has the value "Brian"
  10. or download this
     print "What is your name? ";
     my $name = <STDIN>;
     print "Hello, $name!\n";
    
  11. or download this
     $ perl hello.pl
     What is your name? Brian
     Hello, Brian
     !
     $
    
  12. or download this
     print "What is your name? ";
     my $name = <STDIN>;
     chomp($name);
     print "Hello, $name!\n";
    
  13. or download this
     $ perl hello.pl
     What is your name? Brian
     Hello, Brian!
     $
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perltutorial [id://418141]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-03-29 13:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found