nejcPirc has asked for the wisdom of the Perl Monks concerning the following question:
Thanx.$month="January"; %months=('January' =>01, 'February' =>02, 'March' =>03, 'April' =>04, 'May' =>05, 'June' =>06, 'July' =>07, 'August' =>08, 'September'=>09, 'October' =>10, 'November' =>11, 'December' =>12 ); # if($month ?in? %months) # { $month=%months{$month}; } print "$month\n"; #output-> "01"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replacing string with number
by Arunbear (Prior) on Sep 30, 2004 at 11:53 UTC | |
by nejcPirc (Acolyte) on Sep 30, 2004 at 12:00 UTC | |
|
Re: Replacing string with number
by tachyon (Chancellor) on Sep 30, 2004 at 11:54 UTC | |
|
Re: Replacing string with number
by ikegami (Patriarch) on Sep 30, 2004 at 14:42 UTC |