Welcome future Perl Maven!

What can you do here?

If you are a beginner, or would like to refresh your Perl programming knowledge, you can go over the Perl tutorial.

You will find a few advanced articles too, though most of the advanced articles are available to the subscribers of the Perl Maven Pro service only.

If you are interested to listen to or even see other Perl developers, the Perl Maven TV Show is a collection of such interviews.

Want to make sure you don't miss any of the Perl Maven articels? Sign up to the newsletter!

Recent Articles

Check several regexes on many strings

Once in a while I have to go through lines of a file that match 2, and sometimes even more regexes.

If there only two regexes: A and B, one might be tempted to combine the two something like this:


but that just create a regex that is much more complex that necessary and one that is also probably much slower.

The solution could be as simple as writing

while (my $line = <$fh>) { if ($line =~ /A/ and $line =~ /B/) { print $line; } }

But what happens if there are more than one regexes?

Check several regexes on many strings

Pro: Test without a Plan

We left the previous article with a small issue involving lack of DRY-ness.

The slight problem was, that we hard-coded the number of tests in the use Test::Simple tests => 5; expression. If we now add a new test-entry to the @cases array, we have to remember to update the test plan as well.

Not a big issue, but we as programmers are supposed to avoid any such repetition. So how can we do that?

Test without a Plan

Finding all Plack Middleware or Perl::Critic Policies

Recently I was working on a patch for MetaCPAN, but then it turned out that I don't need to implement it as it is already working. I wanted to be able to list all the modules within a namespace. Apparently it is very easy. I only need to prefix my search with module:

Finding all Plack Middleware or Perl::Critic Policies

Do you want to improve your Perl?

Register to the FREE Perl Maven newsletter here.
or to the Perl Weekly newletter over there