Mega Code Archive

 
Categories / Perl / Language Basics
 

Printing Output

#The print and printf functions are built-in functions used to display output. #The print function arguments consist of a comma-separated list of strings and/or numbers. #The printf function is used for formatting output. #Parentheses are not required around the argument list. #print value, value, value; #printf ( string format [, mixed args [, mixed ...]] ); print "Hello, world\n"; print "Hello,", " world\n"; print ("this is a test!\n");   print "The the date and time are: ", localtime, "\n"; printf "Hello, world\n"; printf("Meet %s%:Age 5d%:Salary \$10.2f\n", "John", 40, 55000);