DOS pattern matching, in Perl

Perl’s file globbing uses the FreeBSD-style globbing, but it works mostly everywhere since Perl handles it internally through the File::Glob module. I’m working on the “Directory Operations” chapter for Learning Perl, 7th edition, where we cover glob. I’m trying to make the book more Windows friendly so I’ve been considering how this stuff translates.

I ran across Raymond Chen’s “How did wildcards work in MS-DOS?”. He lays out the steps for turning what we think of as a pattern (such as “*.txt”) into the CP/M-style pattern that MS-DOS used. He shows how to convert the glob pattern to primitive pattern. Continue reading “DOS pattern matching, in Perl”

Updates to Chapter 13, “Directory Operations”

[This post notes differences between the fifth and sixth editions.]

Our updates to Chapter 13 aren’t that exciting. There’s not much that has changed in the world of Perl and directories. It’s almost dull, even.

  • Use variables as directory handles: opendir my $dir, $directory.
  • Mention a couple more modules incidental to some of the examples, including File::Spec::Functions, Path::Class, and File::Temp
  • Show a find2perl example. We mentioned File::Find only to say that we weren’t going to say anything about it. Also mention the improved interfaces of File::Finder and File::Find::Rule