Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Basic Input and Output

by root (Scribe)
on Nov 05, 1999 at 05:53 UTC ( #955=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    $a=<>;       #reads one line in from the keyboard including
                 #the newline character (\n) and puts it into $a
    while(<>){        #reads lines until end of file or a Control-D from t
    +he keyboard
       print "$_";    #prints lines back out
  2. or download this
    print "Hello World\n";    #the simplest sort of print
    print "Hello ","World\n"; #this prints the same thing but uses a list 
    +of strings to do the same thing
    print ("1+1=",(1+1));     #prints 1+1=2 first prints the string 1+1= a
    +nd then what 1+1 evaluates to(2);
  3. or download this
    printf "%3d %7.2f %5s\n",$a,$b,$c;

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2016-10-24 15:57 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (309 votes). Check out past polls.