0
Perl - Practical Extraction and Report Language

Perl is an interpreted scripting language.

Perl is optimised for scanning arbitrary text files and system administration.

It has built-in extended regular expression matching and replacement, a data-flow mechanism to improve security with setuid scripts and is extensible via modules that can interface to C libraries.


Installation :

sudo apt-get install perl  

sudo apt-get install perl-tk


Compiling method :

perl filename.pl

e.g perl hello.pl



1. Simple Hello World Program

use Tk;
my $mk=MainWindow->new;
my $label=$mk->Label(-text=>'hello world')->pack;
my $label=$mk->Button(-text=>'quit',-command=>\&exit_program)->pack;
MainLoop;
sub exit_program
{
  $mk->Messagebox(-Message=>'goodbye');
  exit;
}



2.  Simple Insertion Program with Push Button

use Tk;
my $mw=MainWindow->new;
my $ent=$mw->Entry()->pack();
my $but=$mw->Button(-text=>"pushme",-command=>\&push_button);
$but->pack;
MainLoop;
sub push_button
{
$ent->insert('end',"hello");
}


Post a Comment

 
Top