Mega Code Archive

 
Categories / Perl / Language Basics
 

Using the print Function

To print text to a file, including to STDOUT, you use the print function.  The print function has these forms: print FILEHANDLE LIST print LIST print If you don't specify a file handle, STDOUT is used.  If you don't specify a list of items to print, the print function prints whatever is in the special Perl variable $_ to the output channel.  The $_ variable is the default variable that holds input from the input channel. print "Hello!\n";