Category Archives: Perl

Find intresting solutions for some Perl problems

Perl and treads

Sometimes, you need to create other threads and let the main thread manage other threads. This is an example how to create a thread in Perl: #!/usr/bin/perl use threads; my $thr = threads->create(‘test’); sub test { REPEAT: print “This is a testn”; goto REPEAT; } #!/usr/bin/perl use threads; my $thr = threads->create(‘test’); sub test {… Read More »

Find the date of a file with Perl

I need to do an incremental download and I need to know the date of the previews file. I found an interesting function in Perl: my $date = localtime( (stat HANDLE)[9] );

Simple backup in Linux

Sometimes, when you writing code you make a lot of mistakes and you want to go back to a previous version, but you don’t have one. It’s recommended that you always back-up your data. I tried a lot of back-up solutions, but they didn’t satisfy what I need. I need to make a backup to… Read More »

Read command line parameters with Perl and Bash

Today I was try to pass some paramters to my CGI script directly from command line. I have a bash file which execute some perl commands and I need it to be configurable. Bellow are two examples of how to read command line parameters, first is with Bash and second one is with Perl: 1.… Read More »