home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


print

print [

filehandle

] 

list

Prints a string or a comma-separated list of strings to the specified filehandle . If no filehandle is given, the function prints to the currently open filehandle (STDOUT initially). The function returns 1 if successful, 0 otherwise. filehandle may be a scalar variable name (unsubscripted), in which case the variable contains either the name of the actual filehandle or a reference to a filehandle object from one of the object-oriented filehandle packages. filehandle may also be a block that returns either kind of value:

print { $OK ? "STDOUT" : "STDERR" } "stuff\n";
print { $iohandle[$i] } "stuff\n";
If list is also omitted, $_ is printed. Note that, because print takes a list, anything in the list is evaluated in list context.