Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: Unhappy returns

by dragonchild (Archbishop)
on Oct 10, 2005 at 17:32 UTC ( [id://498891]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Unhappy returns
in thread Unhappy returns

Overhead how? Depending on what I'm doing, hash-slicing might be harder to maintain than map.
my %is_month_abbrev = map { $_ => undef } qw( jan feb mar apr may jun jul aug sep oct nov dec ); # versus ... my %is_month_abbrev; @is_month_abbrev{ qw( jan feb mar apr may jun jul aug sep oct nov dec +) } = (undef) x 12; # or, with an intermediate array ... my @months = qw( jan feb mar apr may jun jul aug sep oct nov dec ); my %is_month_abbrev; @is_month_abbrev{@months} = (undef) x @months;
Often, losing a few micro-seconds is worth readability and maintainability. In both the slicing solutions, I either needed a separate array or hard-coding a magic number. (The number of months in a year isn't always a given. Some calendars have as few as 10, others have up to 14, and still others vary from year to year.)

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://498891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2025-06-22 17:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.