martedì 7 dicembre 2010

[Linux] Perl

Perl è un linguaggio di programmazione (una specie di linguaggio interpretato (ma la questione non è banale)) che eredita molte delle caratteristiche del C, dell'awk, di sed e di chissà quanti altri linguaggi, creato nel 1987 da Larry Wall (un tipo.. interessante!).

Perl è un ottimo strumento per la manipolazione di stringhe e testo (leggi espressioni regolari) e per le sue caratteristiche è usato da moltissimi sistemisti. (Perl non è un acronimo, anche se ci si riferisce a questo linguaggio come al Practical Extraction and Report Language) pensato per essere facile da imparare e intuitivo (il motto preferito dai perlisti è TMTOWTDI). Questo NON significa che non possa essere utilizzato in modo del tutto incomprensibile. Il numero di moduli ne testimonia l'evoluzione a tutto campo.

http://www.perl.org/

per chi come me volesse cominciare

http://www.perl.org/learn.html


Barzelletta per voi

#!/usr/bin/perl
# joke1.pl
use strict;
use strict;
my @questions = qw(Java Python Perl C);
my @punchlines = (
    "None. Change it once, and it's the same everywhere.",
    "One. He just stands below the socket and the world revolves around him.",
    "A million. One to change it, the rest to try and do it in one line of code.",
    '"CHANGE?!!"'
);
print "Please enter a number between 1 and 4: ";
my $selection = <STDIN>;
$selection -= 1;
print "How many $questions[$selection] ";
print "programmers does it take to change a lightbulb?\n\n";
sleep 2;
print $punchlines[$selection], "\n";
                                                                (fonte: Beginning Perl, 3rd ed)

Nessun commento:

Posta un commento