Perl strict Benchmark

This is a Example-Benchmark about to turn off things you don’t need in Perl:

Our Result:

Maybe a good solution is to use it to check your code and then to comment it out, maybe with a debug variable, for this take a look at Perl Debug Output.

(This is just an Example, don’t turn of use strict.)

Perl random password generator

This is an little example how to generate some password with numbers,lower letter, upper letter and some special chars in Perl :

Some random passwords:

Perl trim decimal number

This is a function to trim a decimal number in Perl, this function did not round the number just make an sub string from the dot to the end:

Result looks like this:

we see missing positions are filled with 0 and longer numbers are trimmed.

Perl sub Benchmark

This is a Benchmark about the subroutines in Perl:


We see the normal way is the best solution.

Perl random number

This is a bit more complex solution to generate a random number in Perl:

It has no max value but normal the highest is 99999.



Perl bignum Benchmark

This is a Benchmark in Perl about bignum :

Our result:

We see the cost is about 12% performance, so if its not really necessary we should tun this feature off.

Perl default defined variables – store and restore

This is a little Script to store all default defined variables from Perl(Linux) into an Scalar ant then to restore everything like it was before the store function.

Important to include my Data-Dumper !

If you want to store your data in the intern arrays, run this:

  • scalar for Regex and program course are stored in “@_Course”
  • scalar for environment are stored in “@_Environment”
  • hashes and arrays are not stored because they are global or lower scope

only variables that writeable are getting stored.

Then restore your saved variables:

you could see if you changed any default variable with(1=changed):

Or you could print all Stored Variables:

(Important to include my dumper.)


scalar for Regex and program course:

$_ – contains current value of a loop

$& – contains match of the current Regex
$` – contains the left side of the current Regex
$’– contains the right side of the current Regex

$1,$2,.. – contains matching groups of Regex
$+ – contains the last group match of an Regex

$. – contains the current line number of the input file

$/ – sets the input record separator

$\ – sets the output record separator, added to every print.

$, – sets the output field separator, added to ever coma separated element

$” – sets the output list separator, added to ever coma separated list

$| – output auto flush, disables the output buffer. 0=off, 1=on



$% – current page number
$= – number of lines per page
$- – number of lines left on the page
$~ – name of the current format
$^ – name of the current head format
$: – delimiter of multiple lines
$^L – delimiter of multiple pages
$^A – accumulator


scalar for environment are stored:
$? – contains the last status of a pipe or child process

$! – contains the error status of a pipe or child process.

$@ – contains an empty string if eval works, and if not it contains the error

$$ – process id
$< – real user id
$> – effective user id
$( – real group id
$) – effective group id

$0 – current program name

$] – current Perl version(is deprecated use $^V instead)

$^D – current debugging flag, run your program wit the -D parameter
$^F – highest file descriptor
$^H – contains the number of syntax checks from use strict and other checks
$^I – is defined or undefined if the Inplace flag is set
$^M – could save data if no more ram is available
$^O -contains the current operating system

$^P – contains the current debugging status
$^S – the status of the per interpreter, if eval is running its undefined
$^T – contains the start time of the script

$^V -current Perl interpreter version

$^W – contains warning from the -w parameter, 1 if set, else 0
$^X – contains the current Perl interpreter path


hashes and arrays:
@_ – contains the parameter from calling a function

@ARGV – contains the parameter from calling your Perl script

@INC -paths where Perl looks for Modules

@ISA – contains a list of basic classes for object oriented
@EXPORT – Used for Modules to export
@EXPORT_OK – Used for Modules to export, but optional
%ENV – contains environment variables from your system

%SIG – contains Signal Handler to communicate to other processes


If you want a list as comment block use this:

Perl Benchmark IN sub with grep

If you miss the IN function in Perl like the function in PL/SQL, then you could use grep and an array to check this:

I made a Benchmark to check how fast his solution is:


We see the normal way is the fastest and you could use an defined array to speed up by 7%. The Code is short but much slower than an or comparison.

perl shuffle String and Array

I wrote a little script in Perl to shuffle Arrays or strings:

This are my examples:

and we got his as result:

Perl serial key generator

The Problem is that I need a god solution to make a serial key in Perl, and so I wrote this program.You could give him a ID to generate a unique serial or you could just use the random function.


is the function for the serial, it generates 10 Blocks of 8 numbers, the first is the ID, with the ID you could generate the serial, then from 2-9 is the serial and the last block is a quick checksum.


It calculates a simple checksum from block 2-9 and number 10. the checksum.Its just a simple calculation to implement it in your client software so they don’t could reverse engineer your serial generator code.


This makes the full key check you should use this script only in your server software.


Serials from 1 to 20 :


This is a little test to make the client software in JavaScript:

but it only haves a different between 0 and 200 …. so its more try and error.