lainchan / λ
What are good beginner books on Perl?
dictionary · 2025-08-09 11:15
I want to learn Perl to advance my horizon in terms of scripting, and Perl seems like a convenient language for both replacing more complex shell scripts and writing simple backend scripts. In my experience I learn best from reading from a book, hence my question: What beginner Perl books can you recommend? I would appreciate it if the style and functionality discussed includes recent developments, though I'm aware that due to it being Perl, I'd also be okay if it's somewhat outdated. I'd rather have an outdated book that teaches me language well, rather than a new book that is not very helpful at at all.
Technician · 2025-08-09 18:54
Based choice, anon. I went with Learning Perl and then Programming Perl back in the day. Also, Modern Perl by chromatic. That was over a decade ago though. Make sure to write plenty of code and go through the exercises.
Cowboy · 2025-08-10 02:35
>>42745
The only Perl book I ever bought was the classic Camel Book. I was a beginner when I first got it, and it was a text that I could refer back to often as I moved from beginner to intermediate.
https://en.wikipedia.org/wiki/Programming_Perl
For beginner oriented texts, I can't vouch for any of these, but this is what's "officially" recommended.
https://learn.perl.org/books/
word · 2025-08-10 03:26
https://threevirtues.dev/
there are three great virtues of a programmer;
Laziness, Impatience and Hubris
Nemissa · 2025-08-10 09:39
https://www.onyxneon.com/books/modern_perl/ and Ovid's "Beginning Perl"
Modern Perl is best after becoming familiar with the basics but good for a casual skim-through to be aware of the scope of what can be done
XERXES · 2025-08-13 11:53
>>42745
I found a Perl book in the book thread that sounds like it fits your ethos well, skim through and see if you like it.
>>42661
HELIOS · 2025-08-15 07:25
Here's how I've been interacting with databases in Perl lately. My goal was to reduce the noise that's typical of database code that uses the DBI interface directly.
https://metacpan.org/pod/DBI
# Return two closures to make SQL interaction easier.
# $sql is for SELECT queries.
# $do is for INSERT, UPDATE, and DELETE statements and anything mutatey.
sub sql_fn {
my $dbh = shift;
my $sql = sub {
my $query = shift;
$dbh->selectall_array($query, { Slice => {} }, @_);
};
my $do = sub {
my $statement = shift;
$dbh->do($statement, { Slice => {} }, @_);
};
($sql, $do);
} To use this, you'd do something like this.
my $dbh = DBI->connect("dbi:SQLite:dbname=wn.db");
my ($sql, $do) = sql_fn($dbh);
$do->("INSERT INTO foo (a, b) VALUES (?, ?)", 16, 32);
my @r = $sql->("SELECT * FROM foo WHERE a = ?", 16);
If you have a big result set where you need to use a cursor to iterate through the results, use DBI directly. This is for those common situations where the result set is known to be small enough to load in to memory.
drop · 2025-08-19 10:03
>>42745
Learning Perl is the defacto starting point. Typically you'd go from there into Intermediate Perl, then if you want to read a great book, Programming Perl is like the Bible of the language. It takes people years to finish but it's quite incredible.
>>42781
You should look into SQL::Abstract.
Hagbard Celine · 2025-08-21 02:11
>>42794
>You should look into SQL::Abstract.
- I feel like during my earlier years in Perl, I was too cavalier about just pulling in more modules than I needed to do various things.
- I'm trying to rein that in.
- From the SYNOPSIS :: https://metacpan.org/pod/SQL::Abstract
use SQL::Abstract;
my $sql = SQL::Abstract->new;
my($stmt, @bind) = $sql->select($source, \@fields, \%where, $order);
my($stmt, @bind) = $sql->insert($table, \%fieldvals || \@values);
my($stmt, @bind) = $sql->update($table, \%fieldvals, \%where);
my($stmt, @bind) = $sql->delete($table, \%where);
- When I look at SQL::Abstract, I see building blocks for building an ORM.
- It lets you treat the various parts of a query as data.
- Data can be manipulated and recombined in various ways, and it's probably a very good tool for building queries dynamically.
- However, a lot of systems (especially small ones), don't have that many super dynamic queries.
- A dictionary of relatively static queries (with parameters) can get you surprisingly far.
I'm not a minimalist by any means. (I use Emacs, afterall.) However, in my second go-around with Perl, I'm trying to do more with less. ...and it's not just Perl. In all other languages I'm using, I'm trying to stay leaner.
RIP to the late mst who maintained SQL::Abstract. (I think the fauci ouchie got him.)
Mentat · 2025-09-21 18:41
https://hayabusa3.2ch.sc/test/read.cgi/news/1757770039/
https://www.youtube.com/watch?v=m_8xLpy80wk
Just another Random Lainon · 2025-10-06 08:19
Someone wrote something new and novel in Perl.
https://github.com/jaggzh/hid-n-seq
Jim Hilger · 2025-10-15 09:15
>>42814
That is a noble cause, however you should understand that Perl is more of a language that does "more with more", the CPAN is Perl's secret weapon, and when using very well tested modules, you can develop pretty much anything in a timely matter.
I do respect your choice to write leaner code though, thanks for your response about SQL::Abstract.
push · 2025-11-13 02:49
https://yapcjapan.org/2025fukuoka/
Hacker · 2026-08-15 10:34
>>42745
>I'd rather have an outdated book that teaches me language well
I got you. Published in '97. Still got my copy..
Knuth · 2026-08-28 19:35
>>43522
Now happening again this year in 2026. The japanese Perl scene is fuarking insane
https://yapcjapan.org/2026tokyo/
Jean Dupont · 2026-09-08 18:33
>>44749
Wow, Larry's going to be there.
Joey · 2026-09-08 18:54
>>44749
What's the Japanese tech scene like in 2026? BSD? Plan9? After the PC-9800 scene and early internet dried up, what are they all angled at?