Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Perl is a text-processing language created by Larry Wall in 1987 and still shipped and maintained as Perl 5. Famous for its motto "there's more than one way to do it," it bakes regular expressions directly into the syntax and pairs them with terse, flexible constructs and hashes. For decades it was the glue of Unix system administration, early CGI web scripting, and bioinformatics pipelines, and it still handles log parsing and one-off automation on countless servers today. On XCODX it runs on a standard Perl 5 interpreter, so you can prototype regexes, hashes, and reporting scripts in the browser without installing a thing.
use strict;
use warnings;
# A tiny word report -- text is Perl's home turf
my $text = "the quick brown fox the lazy dog the end";
my @words = split /\s+/, $text;
my %count;
$count{$_}++ for @words;
print "Total words: ", scalar(@words), "\n";
print "Distinct words: ", scalar(keys %count), "\n";
for my $w (sort { $count{$b} <=> $count{$a} } keys %count) {
print "$w: $count{$w}\n";
}
Perl shines whenever the job is text: extracting fields from log files, rewriting configuration, munging CSV, or gluing command-line tools together with regular expressions that are part of the language itself. Reach for it when a task is too gnarly for a shell one-liner but not worth a full application, or when you are maintaining the large body of existing Perl across sysadmin and bioinformatics code. It is a poor fit for modern front-end web work or data-science notebooks, where Python and JavaScript have far larger, more actively maintained library ecosystems.
No. The sandbox runs a stock Perl 5 interpreter with core modules only, and there is no cpan or cpanm and no network access to fetch anything. Modules that ship with Perl -- such as List::Util, Data::Dumper, POSIX, and Scalar::Util -- are importable with use, but CPAN distributions are not. Install Perl with a local toolchain if you need CPAN.
Read a line from the <STDIN> filehandle, for example my $name = <STDIN>;, then call chomp $name; to strip the trailing newline. In XCODX you type into the live terminal or fill the Stdin Box, and pressing Ctrl+D closes the stream so a loop like while (my $line = <STDIN>) can end. Evaluating <STDIN> in list context slurps every remaining line into an array.
They switch on Perl's safety net: use strict forces you to declare variables with my and catches typos in symbol names, while use warnings flags suspect code such as using an undefined value. They are optional, but adding both at the top of every script is standard practice and works fine in the sandbox. They surface mistakes early instead of letting them silently corrupt output.
Both are dynamic scripting languages, but Perl was designed around text manipulation and offers many ways to express the same idea, while Python favours one clear, readable style enforced by indentation. Perl's regular expressions are core syntax, whereas Python keeps them in the re module. Most new general-purpose and data projects now choose Python, but Perl stays strong for text-heavy sysadmin work.
Perl remains widely deployed for system administration, log and text processing, and legacy web and bioinformatics code, and it climbed the TIOBE index in early 2026. It is not the usual pick for a brand-new web app or data-science project, where Python dominates. If your work touches heavy regexes or existing Perl scripts, it is very much a live, employable skill.
Perl buffers STDOUT by default, so several prints can be flushed together when the program finishes. To force immediate output, set $| = 1; near the top of your script to enable autoflush. This mainly matters for interactive prompts; in the captured sandbox output the final result is the same either way.
main.plperl<STDIN>print "Hello from Perl!\n";
print "Welcome to XCODX Online Compiler!\n";
my $name = "Developer";
print "Hello, $name!\n";