perl function print
The print function in Perl is used to output one or more strings to a filehandle, or to standard output if no filehandle is specified. The syntax for print function is as follows:
print FILEHANDLE LISTSw:ecruoww.theitroad.com
or
print LIST
Here, FILEHANDLE is the filehandle to write to, and LIST is a list of strings to be printed.
Example:
#!/usr/bin/perl # Open a file in write mode open FILE, ">output.txt" or die $!; # Print a string to the file print FILE "Hello, world!\n"; # Close the file close FILE;
In this example, we first open a file called output.txt in write mode using the open function. We then use the print function to output the string "Hello, world!\n" to the file. Finally, we close the file using the close function.
