in reply to Replacing $mon with Jan, Feb, Mar by regex or other means
$mon is always going to be a numeric index, between 0 and 11. We can set up an array of months, then use this index to select out each month in turn:
Alternatively, and definitely overkill, would be to use the Date::Calc module: this contains a Month_to_Text function that can be used to do the same job:my @months = ( qw/Jan Feb Mar Apr May ... Dec/ ); my $month = $months[$mon];
On reflection, that's most definitely not as clear, or concise, and I much prefer the first solution.my $month = substr(Month_to_Text($mon + 1), 0, 3);
Just a couple of ideas.
-- Foxcub
A friend is someone who can see straight through you, yet still enjoy the view. (Anon)
|
|---|