Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Comments start with a hash symbol and run to the end of the line
# This is a comment
Whitespace is irrelevant:
However, only double quotes "interpolate" variables and special characters such as newlines (\n ):
print 42;
You can use parentheses for functions' arguments or omit them according to your personal taste. They
are only required occasionally to clarify issues of precedence. Following two statements produce same
result.
print("Hello, world\n");
print "Hello, world\n";
A PERL script can be created inside of any normal simple-text editor program. There are several
programs available for every type of platform. There are many programs designed for programmers
available for download on the web.
Regardless of the program you choose to use, a PERL file must be saved with a .pl (.PL) file extension
in order to be recognized as a functioning PERL script. File names can contain numbers, symbols, and
letters but must not contain a space. Use an underscore (_) in places of spaces.
First PERL Program
Assuming you are already on Unix $ prompt. So now open a text file hello.pl using vi or vim editor and
put the following lines inside your file.
#!/usr/bin/perl
Before you execute your script be sure to CHMOD the script file and give execution priviledge,
generally a setting of 0755 works perfectly.
Now to run hello.pl Perl program from the Unix command line, issue the following command at your
UNIX $ prompt:
$perl hello.pl
$perl -v
RESULT : This is perl, version 5.001
................
You can use -e option at command line which lets you execute Perl statements from the command line.