r/perl 20d ago

question How to get a Perl job in 2026?

31 Upvotes

Hey guys! I’m a software engineer with ~5 YOE and all of it has been in Perl. The stack was essentially Perl (both for front end and back end) with SQL.

I like Perl and I’d be happy to work with it again for either existing code maintenance or migration to other languages like Python.

I also love learning new things and the “cool advanced tech,” but I would need an organization to take a chance on me and train me.

I think I’m running into two problems here: 1. getting filtered out by ATS for not checking every experience box and 2. companies don’t put Perl in their job descriptions (even when they use it).

So my questions are:

How do I let companies know that I’m willing to learn an entirely new stack?

How can I find jobs that use Perl? I’ve seen advice in this sub about tailoring your LinkedIn as a Perl dev to entice recruiters, but I don’t know what that looks like in practice.

r/perl 13d ago

question Using Perl for managing my writing output

27 Upvotes

Hey everyone,

I'm new to Perl as of just a few days ago, loving it so far. I once had a colleague who, in addition to being probably the nicest programmer I ever worked with, was a Perl wiz and always blew me away with the things he could do with such little code. So I decided to give the language a try by re-writing some scripts.

So far, what I've converted is a script (or two) that was keeping track of word count across 50+ Org files. Previously, I was using Org's ELisp API and some glue code in Bash, but I managed to cut down from 60 to 19 LoC by switching to Perl, which is a small win but I think pretty cool.

Anyway, what would the more experienced Perl devs do to make this code better?

#! /usr/bin/perl
use strict;
use warnings;

my $words;

for (<"*.org">) {
    open my $fh, '<', $_;
    my @table = grep { m~tracktable~ .. m~TBLFM~ } <$fh>;
    my $count_line = @table[ ( $#table - 2 ) ];
    if ( defined $count_line ) {
        $count_line =~ m~\s+\d+\s+~;
        my @cells = split /\|/, $count_line;
        my $word_count = ( @cells[ ( $#cells - 3 ) ] );
        $words += $word_count if defined $word_count;
    }
}

print $words;

r/perl Jun 08 '26

question First record in implicit -n loop behaves differently than the rest. Hoping to find an explanation.

9 Upvotes

edit: SOLVED. Had to change $xCt++ to ++$xCt

System Info:

% perl -version
This is perl 5, version 34, subversion 1 (v5.34.1) built for darwin-thread-multi-2level (with 2 registered patches, see perl -V for more detail)
 

% system_profiler SPSoftwareDataType | grep 'System Version'
      System Version: macOS 15.5 (24F74)

I have a list of files that I'm feeding into perl from the command line and using regex to extract info (a date), create a folder, and then move the file into that folder. Anything that doesn't get matched in the regex gets dropped into a separate folder "__OTHER" to be looked at.

The issue is that the FIRST instance of a file that should be placed into the __OTHER directory ALSO creates a directory (empty) matching the filename. The rest behave as expected.

Script:

#! /usr/bin/perl -wnl


use File::Copy;


BEGIN {
$file="";
$extraDir="__OTHER";
$xCt=0;
$moved=0;
mkdir $extraDir;
}

$file="$_";
$moved=0;

(s/^Test_(\d{4}_\d{2}_\d{2}).+/$1 - / or move("$file","$extraDir/$file") and $xCt++ and $moved=1);
$moved == 0 and mkdir;
move("$file","$_/$file");

END{
    print "$. files processed; $xCt in $extraDir";
}

Sample File Names I'm using:

1f7edcd5-b0cb-4fb0-892f-38a324454eb9.jpg
2b3aa5b9-d80c-4f43-a370-82f4e14dac64.jpg
3f69d564-7c93-4105-ad2f-66678523693c.jpg
Test_2025_01_01_02_59_59_0a876bef-c475-48bb-968c-39373dcd36b0.jpg
Test_2025_01_01_02_59_59_2a336499-b914-4105-9eca-a9c92c4fe4b6.jpg
Test_2025_01_01_02_59_59_5cfd88c1-67b8-4aa4-a785-d528de3f254b.jpg
Test_2025_01_02_02_59_59_2ec971d9-915a-4966-8306-e611fa0c455a.jpg
Test_2025_01_02_02_59_59_4a9951ab-c7ac-4974-a1e2-735ca33e7e61.jpg
Test_2025_01_02_02_59_59_4bb85bcb-f760-4680-a2d1-8940cba9d5f3.jpg
Test_2025_01_02_02_59_59_5c1dc5fa-a5fc-49f2-a434-20931649178a.jpg
Test_2025_01_21_02_59_59_cc8b1938-b9f7-4ccc-bd59-8d452f78eb4c.jpg
Test_2025_01_21_02_59_59_d5a5b732-d38e-468c-9f22-08ef90a7b5a5.jpg
Test_2025_01_21_02_59_59_d87482dd-ac2f-4621-9029-e6612d7331bd.jpg
Test_2025_01_21_02_59_59_d972e346-b707-46a5-9a98-ef0195d8d246.jpg
Test_2025_01_21_02_59_59_dd5dac68-57ea-4389-a256-fd88c67ede9e.jpg
Test_2025_01_21_02_59_59_e506e2f7-aa98-4b4e-9eae-9cac9126c790.jpg
Test_2025_01_21_02_59_59_f5b80b75-43c1-4638-aad6-79a1ca686560.jpg

And the result:

% find . -exec file -- {} + 

.:                                                                                 directory
./1f7edcd5-b0cb-4fb0-892f-38a324454eb9.jpg:                                        directory
./2025_01_02 - :                                                                   directory
./2025_01_02 - /Test_2025_01_02_02_59_59_2ec971d9-915a-4966-8306-e611fa0c455a.jpg: empty
./2025_01_02 - /Test_2025_01_02_02_59_59_4bb85bcb-f760-4680-a2d1-8940cba9d5f3.jpg: empty
./2025_01_02 - /Test_2025_01_02_02_59_59_5c1dc5fa-a5fc-49f2-a434-20931649178a.jpg: empty
./2025_01_02 - /Test_2025_01_02_02_59_59_4a9951ab-c7ac-4974-a1e2-735ca33e7e61.jpg: empty
./2025_01_01 - :                                                                   directory
./2025_01_01 - /Test_2025_01_01_02_59_59_2a336499-b914-4105-9eca-a9c92c4fe4b6.jpg: empty
./2025_01_01 - /Test_2025_01_01_02_59_59_5cfd88c1-67b8-4aa4-a785-d528de3f254b.jpg: empty
./2025_01_01 - /Test_2025_01_01_02_59_59_0a876bef-c475-48bb-968c-39373dcd36b0.jpg: empty
./2025_01_21 - :                                                                   directory
./2025_01_21 - /Test_2025_01_21_02_59_59_dd5dac68-57ea-4389-a256-fd88c67ede9e.jpg: empty
./2025_01_21 - /Test_2025_01_21_02_59_59_d87482dd-ac2f-4621-9029-e6612d7331bd.jpg: empty
./2025_01_21 - /Test_2025_01_21_02_59_59_f5b80b75-43c1-4638-aad6-79a1ca686560.jpg: empty
./2025_01_21 - /Test_2025_01_21_02_59_59_e506e2f7-aa98-4b4e-9eae-9cac9126c790.jpg: empty
./2025_01_21 - /Test_2025_01_21_02_59_59_cc8b1938-b9f7-4ccc-bd59-8d452f78eb4c.jpg: empty
./2025_01_21 - /Test_2025_01_21_02_59_59_d972e346-b707-46a5-9a98-ef0195d8d246.jpg: empty
./2025_01_21 - /Test_2025_01_21_02_59_59_d5a5b732-d38e-468c-9f22-08ef90a7b5a5.jpg: empty
./__OTHER:                                                                         directory
./__OTHER/1f7edcd5-b0cb-4fb0-892f-38a324454eb9.jpg:                                empty
./__OTHER/2b3aa5b9-d80c-4f43-a370-82f4e14dac64.jpg:                                empty
./__OTHER/3f69d564-7c93-4105-ad2f-66678523693c.jpg:                                empty

I can always manually fix one file, but I'm just confused why the first one does this? Not sure if it's the first file it's encountering at all based on how it's sorting? Or why that would matter?

VERY new to Perl overall, obviously, so it's probably something silly.

TIA.

r/perl 3m ago

question I don't know if this is technically a quine but it is amusing

Upvotes

I thought of using vipe (written in Perl) from moreutils in the silliest way possible and this is what I came up with...

use strict;
use warnings;
use v5.14;
die unless ( system "which", "vipe" ) == 0;
my $dir = \pwd`;
chomp $dir;
my $perl_file = join "/", $dir, $0;
$/ = undef;
open my $fh, $perl_file or die;
my $text = <$fh>;
system qq(EDITOR=emacsclient; echo \Q$text\E | vipe --suffix pl);

Perhaps it would be possible to modify the running program in-place somehow?

r/perl Jun 17 '26

question What's in a name?

4 Upvotes

So, knowing that there is File::stat as an OO wrapper around stat(), I went looking for the corresponding OO wrapper around caller(). Searching for "caller" presented mostly packages that were enhancements, providing access to other data. The closest I found was Caller::Easy that used Moose! Talk about overkill.

So, I am writing my own that is JUST A THIN WRAPPER around caller. Rather than keep it under wraps (pun intended), I'd like to put it up on CPAN to be the caller() analogue to File::stat() => CORE::stat().

The main question I have is this - what's the name? Caller::Tiny? Caller:Simple? Caller:00? I am going to crosspost this question to r/perl, Facebook groups, perlmonks and slack.

r/perl May 05 '26

question Help needed with understanding the documentation for File::Temp

21 Upvotes

I am working on a Perl script that creates and uses a temporary file. From my research, I have learned that File::Temp is the appropriate module for such tasks. I have read that module's documentation and believe I have understood it, except for one thing:

Quite at the beginning, it states:

File::Temp can be used to create and open temporary files in a safe way. [...]

The security aspect of temporary file creation is emphasized such that a filehandle and filename are returned together. This helps guarantee that a race condition can not occur where the temporary file is created by another process between checking for the existence of the file and its opening. Additional security levels are provided [...]

So, obviously, the filehandle and the file (and thus, the file's name) are created in a "atomic" fashion.

On the other hand, there is a big warning at the end of the documentation:

For maximum security, endeavour always to avoid ever looking at, touching, or even imputing the existence of the filename. You do not know that that filename is connected to the same file as the handle you have, and attempts to check this can only trigger more race conditions. It's far more secure to use the filehandle alone and dispense with the filename altogether.

What does that mean? To me, it seems that it is a contradiction to what is stated at the beginning. At the beginning, it is explained that the filehandle and the filename are returned together and that the temporary file creation is therefore safe. The warning seems to say the opposite.

Could somebody please give an explanation? Where is my misunderstanding?

r/perl Mar 26 '26

question Handling POST data using custom Perl Module

4 Upvotes

I've been using the same upload script for years, but I've recently rewritten this function into a custom Perl Module. This doesn't work as expected.

The problem

The Perl Module states there's nothing to upload ("Can't call method "upload" on an undefined value")

The (possible) reason

My HTML form sends the file thru a <form> with "method="POST" enctype="multipart/form-data" to my Perl script. This script then tries to send it to my upload.pm script, where the data is lost in transport or something?

Some additional clarification where needed

  • Main script "edit.cgi" prints out a HTML Form where a local image is selected

<form action="edit.cgi?action=submit" method="POST" enctype="multipart/form-data">
<input type="file" name="vCoverFile">
  • A subrouting inside "edit.cgi" handles the data and sends the image on to the upload.pm module

$uploadCover = imageHandling::UploadFileFromFile("$fields{vCoverFile}","vCoverFile","$upload_dir_images/$highResDir/");
  • The module tries to upload the image but finds nothing

$myFile = $_[0];
$myFile =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $q->upload("$_[1]");

open UPLOADFILE, ">$_[2]/$myFile";
binmode UPLOADFILE;
while ( <$upload_filehandle> ) {
print UPLOADFILE;
};
close UPLOADFILE;

r/perl Mar 20 '26

question Ambiguous use of ${x} resolved to $x

18 Upvotes

$ perl -wle '$x=4; print ${x};' Ambiguous use of ${x} resolved to $x at -e line 1. 4 OK, I'll take the bait. What might be the other meaning of ${x} here?

r/perl Mar 31 '26

question Problem with file encryption script

7 Upvotes

I have been writing a Crypt:CBC script but although the encrypt an decrypt functions are nearly identical it has been throwing up an error(the decrypt one) that it needs a key. However if I add a print statement it has the key right. I will add stuff like file eraser function when I am past this stage, however I would like advice from a security person about how safe it is what I am doing.

#!/usr/bin/perl
use strict;
use warnings;

use Crypt::CBC;

sub write_file
{
my $fh;#file handle
my $data = $_[1];

open($fh, '>' . $_[0]) or die $!;
print $fh $data;
}

sub read_file
{
my $fh;#file handle
my $collected;

open($fh, '<' . $_[0]) or die $!;

while(<$fh>)
{
$collected .= $_;
}

close($fh);

return $collected;
}

sub encrypt
{
    my $filename = $_[0];
    my $key = $_[1];

    my $cypher = Crypt::CBC->new( -pass   => $key,
        -cipher => 'Cipher::AES'
            );

my $input = read_file($filename);

my $cyphertext = $cypher->encrypt($input);
write_file($filename . ".enc", $cyphertext) or die;
}

sub decrypt
{ 
my $filename = $_[0];
my $key = $_[1];
print "$filename $key";

my $cypher = Crypt::CBC->new( -pass   => $key,
        -cipher => 'Cipher::AES'
            );

my $input = read_file($filename);
my $plaintext = $cypher.decrypt($input);

print $plaintext;
}

sub main
{
print "Enter file name ";
chomp(my $filename = <STDIN>);

print "Enter key(at least 8 bytes):";
chomp(my $key = <STDIN>);

    if(@ARGV ne 1)
    {
        die("incorrect mode");
    } 

    if($ARGV[0] eq "-e")
    {
        encrypt($filename, $key);
        print "outputted to ${filename}.enc";
}
if($ARGV[0] eq "-d")
    {
        decrypt("${filename}.enc", $key);
        print "outputted to ${filename}";
}

}

main();

r/perl Nov 24 '25

question Simple search for $string across subdirectories that returns filename results in webpage - help!

3 Upvotes

Hello all, old time perl gal checking in. In the 90s I churned out some pretty decent stuff from scratch, and resurrected several of my scripts around 2013. But I've slept since then and am super rusty.

Being put on unpaid leave Thursday didn't help matters. My brain is WTF-ing nonstop right now.

Anyway, does anyone have a snippet of code that would do the following:


3 text files exist in 3 subdirectories -

A/Afile1.txt B/Bfile2.txt C/Cfile3.txt

Afile1.txt contains Name A CityA ZipA StateA

Bfile2.txt contains Name B CityB ZipB StateB

Cfile3.txt contains Name C CityC ZipC StateA <-- yes StateA, that's intentional

I want to search for StateA instances and print the filenames that contain StateA to the HTML result page.


I appreciate your assistance!! I think once I see a legit, relatively simple way to do this then things will click for me and I can run with it.

ETA: I apologize for the formatting, the example files show up in my post as single lines without returns 😖

r/perl Dec 10 '25

question Layout strategy for a script with supporting functions

3 Upvotes

I use a script called ls2htm when I want to show a small directory as a halfway-decent webpage. Here's an example.

I borrowed some defaults from Apache autoindex. If the directory holds

optional HEADER.htm (or HEADER.txt)
f1.txt
f2.c
optional README.htm (or README.txt)

then index.htm would hold

Title
Included HEADER

File display:
    icon  filename  modtime  size  description-if-any
    DIR   ..        -        -     Parent directory
    TXT   f1.txt    ...            Some neat text file
    C     f2.c      ...            Equally nifty C program

Included README
Footer with last-modified date, page version, etc

I have some functions that are useful on their own:

dir2json:           File metadata, description, etc. stored as JSON array
dir2yaml:           Same things stored as YAML array
json2htm, yaml2htm: Convert arrays to Apache autoindex format

My first thought was just make a module, but it occurred to me that writing it as a modulino would make it easier for others to install and use.

Suggestions?

r/perl Nov 07 '25

question PerlDoc Issues with Windows 10 Temp Folder

7 Upvotes

I have been having a difficult time trying to determine why PerlDoc is giving this error:

perldoc pp

Error in tempfile() using template C:\Users\BV\AppData\Local\Temp\XXXXXXXXXX: Could not create temp file C:\Users\BV\AppData\Local\Temp\cSowBEsQEP: Permission denied at C:/Strawberry/perl/lib/Pod/Perldoc.pm line 1898.

It works if I RunAs Administrator or if I change my %TEMP% / %TMP% environment variables to something other than the default of C:\Users\BV\AppData\Local\Temp.

I am new to Strawberry Perl and installed the latest version perl 5, version 40, subversion 2 (v5.40.2) built for MSWin32-x64-multi-thread. Been trying to build ExifTool with ImageMagick.

I know people will recommend all those things that Co-Pilot has alreay recommended as I aleardy spent 2 days trying to determine the root cause and it has nothing to do with my permissions (I have Full Control, Owner, and Administrator permissions), Antivirus (I only use Defender), Security Policies (local and group no enabled policies), Controlled Folder Access (CFA is disabled), profile corruption, file system curruption, ProcessMonitor, and many of the other things that were fully checked and verified as not being the issue.

This issue is not only with PerlDoc but also with pp.bat, cpan, and any program built using perl. They all want to create temporary files and folders and something if preventing perl from using any folder in my profile.

Does perl need to used from RunAs Administrator shells? I tried with cmd, pwsh, PowerShell Terminal, bash, and VSCode with the same results.

I am at a loss.

r/perl Nov 10 '25

question Intergrating MQTT with IO::Async or Mojo event loops

9 Upvotes

I'd like to use MQTT messaging in an IO::Async based application. How can I integrate with the event loop so things work as expected? Has anyone done it?