Make your own free website on
Abridged Perl/Tk Tutorial

Abridged Perl/Tk Tutorial

Perl/Tk (also known as pTk or ptk) is a collection of modules and code that attempts to wed the easily configured Tk 8 widget toolkit to the powerful lexigraphic, dynamic memory, I/O, and object-oriented capabilities of Perl 5. In other words, it is an interpreted scripting language for making widgets and programs with Graphical User Interfaces (GUI).

Perl or Practical Extraction and Report Language is described by Larry Wall, Perl's author, as follows: "Perl is an interpreted language optimized for scanning arbitrary text files, extracting information from those text files, and printing reports based on that information. It's also a good language for any system management tasks. The language is intended to be practical (easy to use, efficient, complete) rather than beautiful (tiny, elegant, minimal)."

Tk, the extension(or module) that makes GUI programming in perl possible, is taken from Tcl/Tk. Tcl(Tool Command Language) and Tk(ToolKit) was created by Professor John Ousterhout of the University of California, Berkeley. Tcl is a scripting language that runs on Windows, UNIX and Macintosh platforms. Tk is a standard add-on to Tcl that provides commands to quickly and easily create user interfaces. Later on Tk was used by a lot of other scripting languages like Perl, Python, Ruby etc.

This is a tutorial for Perl/Tk only - I will not be teaching perl here. Come on - why do you think this tutorial is called abridged? So if you know perl, continue. But if you are a beginner to perl, I would recommend that you read my perl tutorial.

Before starting, make sure you have the following things. If some are missing you still can learn perl - but you will not be able to use it to its full power.

  1. ActivePerl from for windows - For programming in Windows. Linux don't need any special outside interpreter because it already has it in most of the distributions.
  2. A good text editor. I would recommend Crimson Editor( for Windows and XEmacs for Linux.

In Unix/Linux you can execute your perl scripts by typing "perl <filename>" at command prompt. If you have ActivePerl, you can execute it by double clicking a perl file in Windows.

One last thing before we begin the tutorial. I will be teaching perl/tk and I expect you to know how to program in perl. I may ignore some of the perl coding conventions like including use strict;, my or any such thing. The examples have only one purpose - to demonstrate the feature that will be taught. Sorry about that - but I have to keep those programs short and to the point.

Author - Binny V A
Personal Site -

Contents Next