- Perl Basics
- Perl - Home
- Perl - Introduction
- Perl - Environment
- Perl - Syntax Overview
- Perl - Data Types
- Perl - Variables
- Perl - Scalars
- Perl - Arrays
- Perl - Hashes
- Perl - IF...ELSE
- Perl - Loops
- Perl - Operators
- Perl - Date & Time
- Perl - Subroutines
- Perl - References
- Perl - Formats
- Perl - File I/O
- Perl - Directories
- Perl - Error Handling
- Perl - Special Variables
- Perl - Coding Standard
- Perl - Regular Expressions
- Perl - Sending Email
- Perl Advanced
- Perl - Socket Programming
- Perl - Object Oriented
- Perl - Database Access
- Perl - CGI Programming
- Perl - Packages & Modules
- Perl - Process Management
- Perl - Embedded Documentation
- Perl - Functions References
- Perl Useful Resources
- Perl - Questions and Answers
- Perl - Quick Guide
- Perl - Useful Resources
- Perl - Discussion
Perl print Function
Description
This function prints the values of the expressions in LIST to the current default output filehandle, or to the one specified by FILEHANDLE.
If set, the $\ variable will be added to the end of the LIST.
If LIST is empty, the value in $_ is printed instead.
print accepts a list of values and every element of the list will be interpreted as an expression.
Syntax
Following is the simple syntax for this function −
print FILEHANDLE LIST print LIST print
Return Value
This function returns 0 on failure and 1 on success.
Example
Following is the example code showing its basic usage −
#!/usr/bin/perl -w $string = "That is test"; @list = (1,2,3,4,5,6,); $index = index ($string, 'is'); print "Position of is in the string $index\n"; print "Print list @list\n";
When above code is executed, it produces the following result −
Position of is in the string 5 Print list 1 2 3 4 5 6
perl_function_references.htm
Advertisements