Perl find lowest divisible number

This Perl Script find the lowest, divisible number from 1 to 10:

The result is 2520.

Fraction calculation in Perl

This Perl script is able to add,subtract,divide and multiply fractional numbers:

This is the output from 1/2 and 1.25, at first add both then subtract from the result, multiply and then divide from the result:

For a better result take a look at Perl high precision.

JavaScript generate an result array from XPATH

This is a function in JavaScript that use an XPATH string to generate an Array from the results.This is very useful if you have to manipulate or use some items on a page and don’t have the id(like bots).

That is the function:

You could use it in the Terminal:

And we get all hrefs on this page in the Terminal:

Use it to store it in an Array and then write it on the page:

and we got this result:

JavaScript string contains

This is a simple function in JavaScript, I use it to check if a string contains another string.The different in this function is that the return value is the position+1.So you could use it in an If without to check the return value manually, just see my test from 1 to 3.

This is the function:

Now we make a little test to see if it work:

Seems good:

Perl reference vs. direct access vs. return Benchmark

This is a little Perl Script where I try to test what way is faster,  I test a normal reference(alias) in a sub vs. the direct access vs. normal access to a variable in a sub and then return the result, here is my Benchmark code:

Our test result:

JavaScript element exists

This is a JavaScript Function to check if an element exists, I use it regularly in an If.

The function:

The test:

Our result:

We could see it works as it should.


In this article I wrote about the Linux-Kernel and the GNU-Project, together they are called GNU/Linux.It is an Unix like Operating system and in the most cases POSIX-compliant and open source.The Kernel was firs released in the year 1991 from Linus Torvalds.


GNU/Linux is often used for Servers, there are a lot of open source software for work, a very powerful Shell and you have always Perl on the System.And the System needs not as much resources as Microsoft Systems.


I regularly use Debian or Mint,Debian is more stable, more for Servers and you could make a minimal installation with or without an GUI.Mint is more for Desktop users with a good looking Desktop.


For more take a look in the GNU/Linux Bash – Category


Perl – Practical Extraction and Report Language is a free high-level, interpreted, dynamic programming language written by Larry Wall in the year 1987.Perl is very good for shell scripting and regualar expression.If you use GNU/Linux is default installed, on windows you have to install ActivePerl.The languages includes Perl 5 and 6, I use primary Perl 5(Perl 5 is also continue developing).The symbol of the Perl language is the Camel symbol.



$ for Scalar,@ for Array and % for Hashes, as example:

In Perl all variables are Scalars, you could store numbers and strings in the same value without convert.If you want to add a Scalar to another you have to concate two strings with “.”, but if you want to add two number you should use “+”.To access an element from the array you could use “$name[0]”, it starts from 0 to the last element, you get the last element with “$#name”.For manipulating a Perl Array look at this Post.And you could choose in  a big list of default variables.



Be careful with quoting, the double quotes could interpolate other Scalars.

The name1 is “1” and name2 is “$a”.



an simple “Hello World!” example:



To compare the Scalars you could use them from this table:

compare type number string
equal == eq
 not equal  != ne
 less than  <  lt
 greater than  >  gt
 less or equal  <=  le
 greater or equal  >=  ge



In Perl are more than one way to make a loop:

the first one is faster and faster to write, but the second has more possibility’s to change.

Do-While loop:

While loop:



Regular Expressions are very good implemented by Perl:



Perl is an interpreted language and if you need more performance you could use Inline code like C or you could take a look at my Benchmarks or at write fast code in Perl.


If you want to see some examples and solution from me see into my Category – Perl or if you want to see some special Tricks in Perl.


The XPATH(XML Path Language) is a query language from the W3C, it is used to select nodes in an XML file.

Full Path

In this example I start with “/” that say we start on root and then i navigate from element to element.



In this example I use the “//” to search in the full document to find all a nodes.(you could use the “//” behind a “/” like “/html/body/div//a” to find all elements in html body div.)



you could use the “@” to find all elements wit the attribute class that is the string “secondarary”.


As example you could select all hrefs where the Attributes contains a string:

Or select all hrefs where the text from the URL contains a string:



If you select all Elements you get an Array, in the example above I select the firs element from my result Array.You should avoid this, better is to navigate over the class or ID because if the Page changes a bit the XPATH don’t work any more.


That are some basics, if you need something special take a look into the Network or on my page.As example Web crawling in PHP or Perl.