1. The first line:
In Unix or linux systems, generally, the first line is:
#!/usr/local/bin/perl
That is the system runs a program by calling the executable
perl file. "/usr/local/bin/" ix the directory where
the file perl is located. In Windows systems, generally,
we have C:\Perl\bin.
Perl 5.12.3
The comment:
#! is not a comment, the sentence:
# This is a comment
is commented.
3. Print function:
example:
print 'Best regards ..';
will have the following output:
Best regards ..
Remarks:
-A Perl statement must end with a semicolon,";"
- The function print uses single quotes. It can use double quotes.
4. The first program
#!C:/Perl/bin/
#
# Program to say regards
#
print 'Regards ..';
If the working directory is "C:\Perl_Programs", save these scrips
in a file such as example.pl and run it as:
C:\Perl_Programs> perl example.pl
The out pu is
Regards ..'
Under UNIX:
-- Use the following command at the UNIX prompt:
chmod u+x example
to make it executable
-- run it as:
perl example or ./example or simply: example
-- We can use the command perl with the followins options:
perl -w example, to output warnings,
perl -d example
to use a debugger .
|