First a syntax nit: personally I don't find that regex any more readable than:

my( $type, $valid, $name, $comment ) = split( qr/:/, $_ );

In fact if you're explicitly wanting it in a hash I'd almost say go with something like this is still (IMHO) clearer:

my %val; @val{ qw/ type valid name comment / } = split( qr/:/, $_ );

Granted you're doing a minimal amount of validation checking [01] on the first two fields, but (without more context on your data) that doesn't feel that compelling. If you were to keep it with your regex with the capture groups then I'd at the least suggest adding an /x and putting whitespace around the colons so it's not as visually . . . run together.

As to your question of using an explicit version: you can check the docs on feature what that turns on (specifically say, state, and the switch construct). Since named capture groups aren't toggled with that all you're getting is maybe bailing earlier in the (as you say) unlikely case you were ever run with an older perl. So . . . meh? That being said though I'm habitually using (say :) say and state so I typically use a much newer required version in what I write. Having that explicitly set regularly helps find problems (typically PATH is messed up and it's running under the ancient OS' /usr/bin/perl not the one it should be which would cause other things to blow up (missing CPAN modules etc.)).

The cake is a lie.
The cake is a lie.
The cake is a lie.


In reply to Re: Should I use v5.10 because of named groups? by Fletch
in thread Should I use v5.10 because of named groups? by hrcerq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.