Perl GetStarted
Topiccs
Install
Windows
Use Active Perl download.
Install check
Open cmd.exe and type
perl -version
Editor
Komodo Edit download
PreHead
Add perl script header
This is example
#!/usr/local/bin/perl
#!/usr/bin/perl -w
Hello World
Let’s started perl.
Create .pl file
print "Hello\n";
To run this script
perl hello.pl
Comment
Use #. This is line comment
#
Multiline comment
=pod This is comment yeah! =cut
Library
CPAN is library warehouse like gem.
undef
It’s Java null, Ruby nil. This is for Perl.
say
like print?, No Java println
say "Hello World!"; my @array = qw(a b c d); say @array;
die
Close program, when the error happens, this is called.
if(!open LOG, “>>”, ‘logfile’) {
die “Cannot create logfile: $!”;
}
if(@ARGV < 2) { die "Not enough arguments\n"; } [/perl]