Perl was originally written for Unix, and some of its features are specific to that operating system. In this course we will do our best to avoid those features or at least draw attention to the places where they are necessary. But Perl is not tied to Unix. Currently there are precompiled Perl distributions available for most common platforms, including the big three: Unix, Macintosh, and Windows.
Question: Is Perl a cross platform programming language?
Answer: Yes, Perl is a cross-platform programming language, which means that Perl code can run on multiple operating systems such as Windows, macOS, and Linux, without any modifications. This makes it an attractive choice for developers who need to write code that can run on a variety of systems, as well as for system administrators who need to write scripts that can be run on different types of servers.
At the most basic level, all windowing platforms (Apple Macintosh, X Windows, and Microsoft Windows) are very simple. They provide a low-level API to create and manage windows, to report interesting events such as mouse and keyboard events, and to draw graphical elements such as lines, circles, and bitmaps. The problem is that drawing even a simple form takes a considerable amount of code and reading thousands of pages of documentation. Often-used patterns of GUI code have evolved into widgets (called "controls" in the Microsoft Windows world); examples include
- buttons,
- scrollbars, and
- listboxes.
Building a GUI is now a simple matter of launching an interactive form designer and dragging and dropping these ready-made components into a layout of your choice. Object-oriented programming has never been easier. It turns out that widgets and scripting languages are a perfect match. Widgets have simple interfaces, and form-based GUIs are not performance-critical. Both of these attributes make GUIs a very fertile ground for scripting. Combine that with the fact that GUIs need the most configurability (because that's the part of the application the user deals with, and for the most part, the GUI is the application), and you can understand the enormous popularity of tools such as Visual Basic, PowerBuilder, and Hypercard. On Unix systems, X Windows has been the windowing platform of choice. Several widget toolkits have been built over X: Athena, InterViews, Motif, and Tk. For professional good looks, ease of use, and documentation, you can't beat Tk. To top it all, it is free! Unlike other widget toolkits, Tk was developed expressly to be driven by a scripting language: Tcl.
Indeed, it can be argued that Tk is the chief reason for Tcl's popularity. There are a lot of people who don't like Tcl as a scripting language but love Tk, and have attempted to adapt it to their favorite scripting language:
- Scheme,
- Python,
- Guile and
- Perl.
Malcolm Beattie made the initial attempt to provide a Perl layer that internally used the Tcl interpreter to reach the Tk library.