Some Keywords Of Perl for Java Environments
Heraldic Crest of Skopje, Macedonia

A Java Library of Classes Based on Select Keywords from Perl


The Skopje project (click here for the Merriam-Webster dictionary page, which includes pronunciation) is an effort to add some of the more useful, yet overlooked, functionality of Perl to Java. The goal is not to try and make Java source code look like Perl (if you want to program in Perl, you'll just program in Perl). Rather, small things like join and chomp are provided to compliment existing methods such as split from the java.lang.String class.

Basic Usage

This distribution provides a single JAR file, Perl.jar. As with any JAR, it is used at run-time by including the file in the classpath of the Java VM, either by means of the CLASSPATH environment variable or the -classpath command-line option.

All the classes (one per keyword) are contained in the com.blackperl.Perl namespace. An application can then import as it needs:

      import com.blackperl.Perl.Chomp;


      // Read a line from the terminal
      StringBuffer line = new StringBuffer(getLineFromUser());
      // Chomp operates in-place on StringBuffer, hence the hoop-jumping
      String stringLine = line.toString();

      // stringLine now has any line-ending sequence (\n, \r\n, etc.) removed

Keeping each piece of functionality in its own class will hopefully lead to smaller run-time footprints and easier use with tools that gather individual classes from multiple JAR files into single JARs for application embedding.


The package is fully documented via Javadoc. The full API docs are bundled in the distribution file.

You may also view them here.


This package is bundled as a ZIP file containing the JAR, the API documentation, the Ant build file, and the full source code (including JUnit tests).

Skopje 0.2

Progress and Plans

At present, the following keywords are implemented:

The following are planned, but are not yet started or ready for release:

The main barrier here is how to efficiently implement the /c (complement) flag in a UTF-16 String class. It was much easier when all text was based on 8-bit (or 7-bit) characters. The most likely approach will be to look at the current Perl code for this, and see what it does for non-8-bit locales.
pack and unpack
This project actually started out from a need for these two (specifically unpack). When it became clear both that there were other useful Perl keywords and (more to the point) that these two were going to be really difficult, the easier ones were done and released first.

In addition to adding more basic keywords, future plans include providing a parallel development track for the upcoming JDK 1.5 release in order to take advantage of some key new features. Specifically, to capitalize on generics and static imports.

Bugs and Requests

Report all bugs (or offer suggestions) to


Skopje is released under the terms of the Artistic License as applied to Perl. Developers using Skopje, in whole or in part, in their projects may also choose to redistribute it under the terms of the GNU Lesser GPL license.

Last updated:
Valid XHTML 1.0! Valid CSS!