This seems connected to one of my pet peeves: why do people put use 5.010 (or higher) in code that is destined for CPAN when the only feature being used is something like say or //=? Why break backwards compatibility for what are, in my opinion, trivial reasons? Is it unreasonable for me to think that gunzip would do that?

That is not to say that when one is writing code for a closed environment, i.e. $work, where everything is fully controlled then by all means write for the latest and greatest that you have confidence in and take full advantage of new features! But keep in mind that there is a great difference between a private environment such as $work, and a public one such as CPAN. Please don't assume that others who want to use an otherwise great CPAN module have the environment that will allow them to use anything higher than 5.8 unless there are compelling reasons to disregard those users.

To be fair, performance could differ between using older code and a newer feature, as the following demonstrates (OS X 10.9, perl v5.16.2). But I honestly think that it would be rare indeed for something like this to even begin to affect the run-time of a real application.

#!/usr/bin/perl use v5.16; use warnings; use Benchmark qw/cmpthese/; my $foo = { bar => 'baz', baz => undef, }; my $foo1 = {}; sub _ifdefined { for ( keys(%{$foo}) ) { $foo1->{$_} = 'default' unless defined($foo->{$_}); } } sub _definedor { for ( keys(%{$foo}) ) { $foo1->{$_} //= 'default'; } } cmpthese( -5, { _ifdefined => sub { _ifdefined() }, _definedor => sub { _definedor() }, } ); exit; __END__ Output: Rate _ifdefined _definedor _ifdefined 1081314/s -- -12% _definedor 1228949/s 14% --

NOTE: if $foo1 is initialized inside the sub-routines then the output changes to this:

Rate _ifdefined _definedor _ifdefined 511025/s -- -1% _definedor 514053/s 1% --
It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

In reply to Re: Make $^V and "my" implicit by boftx
in thread Make $^V and "my" implicit by gunzip

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.