in reply to convert month number to month name

Define a hash table with the translation that you desire. This will be compiled - it only happens once. Then just access that hash table to print the text that you desire.
#!/usr/bin/perl -w use strict; my %xlateNum2Text = qw (0 January 1 Febuary 2 March 3 April 4 May 5 June 6 July 7 August 8 September 9 October 10 November 11 December ); my($day, $month, $year)=(localtime)[3,4,5]; $year = $year + 1900; print "day=$day, month=$month, year=$year\n"; print "day=$day, month=$xlateNum2Text{$month}, year=$year\n"; __END__ Prints: day=30, month=7, year=2012 day=30, month=August, year=2012
Update:
Yes, it is possible to use an array instead of a hash table. However, I would recommend making the intent and translation very clear by using a hash table. In the code above, it is clear what number corresponds to what text, ie, that January is zero, not one.