Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

(jeffa) 2Re: Converting output from numeric values to text

by jeffa (Chancellor)
on Mar 29, 2002 at 00:44 UTC ( #155160=note: print w/ replies, xml ) Need Help??


in reply to Re: Converting output from numeric values to text
in thread Converting output from numeric values to text

Couldn't .... resist .... temptation:

my %month = map { $_ => 1 } qw(jan feb mar apr may jun jul aug sep oct + nov dec);
Or a hash slice:
my %month; my @month = qw(jan feb mar apr may jun jul aug sep oct nov dec); @month{@month} = (1) x @month;
UDPATE:
sorry about that - please allow me to fix it:
my @month = qw(jan feb mar apr may jun jul aug sep oct nov dec); my %month = map { $_ => $month[$_] } (0..$#month); ... $m_name = $month{$m_number};

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)


Comment on (jeffa) 2Re: Converting output from numeric values to text
Select or Download Code
Re: (jeffa) 2Re: Converting output from numeric values to text
by PrakashK (Pilgrim) on Mar 29, 2002 at 04:59 UTC
    I don't think your code produces what the original poster OnTheEdge wanted. Yours would result in a hash with the month names as keys and 1 as values for each.

    He wants to convert month numbers into month names.

    $m_name = qw(jan feb mar apr may jun jul aug sep oct nov dec)[$m_numbe +r];
    /prakash

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-08-29 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (281 votes), past polls