Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Perl Babysteps 1: Your First Simple Script

by webfiend (Vicar)
on Dec 30, 2004 at 00:10 UTC ( #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
Node Status?
node history
Node Type: perltutorial [id://418141]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-12-25 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls