Perl

Logical Defined-Or in Perl

// It’s exactly the same as ||, except that it tests the left hand side’s definiteness instead of its truth. Thus, EXPR1 // EXPR2 returns the value of [...]

Finding html tag

Table Expression        =>    “<table[^>]*>(.*?)” Header Expression     =>    “ <th[^>]*>(.*?)” Row [...]

Sort-command alphanumeric

Sort-command alphanumeric If they all actually begin with "page$" echo "page$1 page$20 page$2 page$10" | sort -k1.5n Answer [...]

The caller() function and $wantarray

The argument of interest is the $wantarray argument. This indicates what return value is expected of the subroutine from where it was called. The subroutine [...]

Using the caller() Function in Subroutines

The caller() function can be used in a subroutine to find out information about where the subroutine was called from and how it was called. Caller takes one [...]

Implied Arguments in perl

When calling a subroutine with the "&" sigil prefix and no parenthesis, the current @_ array gets implicitely passed to the subroutine being called. This [...]

Why should I use the -w argument with my Perl programs?

Many Perl developers use the -w option of the interpreter, especially during the development stages of an application. This warning option turns on many [...]

Env

Perl provides access to environment variables via the global "%ENV" hash. However, if using the ENV module, it will create global scalars for all the [...]

FindBin

Its usage is like: use FindBin; use lib "$FindBin::Bin/../lib"; or use FindBin qw($Bin); use lib [...]

Using hash for counting

When we have an array or a list of items and we want to find out the number of occurrences of a particular item then we generally use the following kind of [...]