Perl ARGV
@ARGV and %ENV The built-in array @ARGV contains the command line arguments for a Perl program. The following run of the Perl program critic.pl will have the ARGV array (“-poetry”, “poem.txt”). unix%...
View ArticlePerl Loop
The Loop Statements Different loop statements in perl… The for Loop The foreach Loop The while Loop The do-while Loop The until Loop The process of executing a code block repetitively is known as...
View ArticlePerl if else
The if…else Statement This statement uses a relational expression to check the validity of a condition and execute a set of statements enclosed in braces. It returns a Boolean value, true or false,...
View ArticlePerl References
Perl References I’m happiest writing Perl code that does not use references because they always give me a mild headache. Here’s the short version of how they work. The backslash operator () computes a...
View ArticlePerl Subroutine
Perl Subroutine sub mysubroutine { print "Not a very interesting routinen"; print "This does the same thing every timen"; } regardless of any parameters that we may want to pass to it. All of the...
View ArticlePerl Regular Expressions
Perl Regular Expressions Metacharacters char meaning ^ beginning of string $ end of string . any character except newline * match 0 or more times + match 1 or more times ? match 0 or 1 times; or:...
View ArticlePerl File Operations
Perl File operations Variables which represent files are called “file handles”, and they are handled differently from other variables. They do not begin with any special character — they are just...
View ArticlePerl OOP
Perl OOP Why Object Oriented approach? A major factor in the invention of Object-Oriented approach is to remove some of the flaws encountered with the procedural approach. In OOP, data is treated as a...
View ArticlePerl DBI
Perl DBI Example The DBI module enables your Perl applications to access multiple database types transparently. You can connect to MySQL, MSSQL, Oracle, Informix, Sybase, ODBC etc. without having to...
View ArticlePerl Signals
Perl Signals Perl allows you to trap signals using the %SIG associative array. Using the signals you want to trap as the key, you can assign a subroutine to that signal. The %SIG array will only...
View ArticlePerl List
List A list is a sequence of scalar values enclosed in parentheses. The following is a simple example of a list: (1, 5.3, “hello”, 2) This list contains four elements, each of which is a scalar value:...
View ArticlePerl Operators
Perl Operators In Perl, the comparison operators are divided into two classes: Comparison operators that work with numbers Comparison operators that work with strings Integer-Comparison Operators...
View ArticlePerl Arrays
Arrays @ Array constants are specified using parenthesis ( ) and the elements are separated with commas. Perl arrays are like lists or collections in other languages since they can grow and shrink, but...
View ArticlePerl Hash Maps
Perl Hash Maps/associative arrays ASSIGNING HASH VALUES hash tables consist of key/value pairs every key is followed by a value values can be assigned to hash tables as %states=...
View ArticlePerl Intro
Introduction to Perl Perl is an acronym, short for Practical Extraction and Report Language. It was designed by Larry Wall as a tool for writing programs in the UNIX environment (Perl is a stable,...
View Article