in reply to Quick search-and-replace month names for numbers
I think you guys are making it too hard.
#!/usr/bin/perl my %month = ( JAN=>'01', FEB=>'02', MAR=>'03', APR=>'04', MAY=>'05', JUN=>'06', JUL=>'07', AUG=>'08', SEP=>'09', OCT=>'10', NOV=>'11', DEC=>'12' ); map { s/^(\w{3}).*/$month{uc $1}/; print(( ($_)?$_:'undef' ), "\n"); } @ARGV; __END__ %./foo january Dec Apr MAY xJun [3:27pm] 01 12 04 05 undef
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Quick search-and-replace month names for numbers
by ambrus (Abbot) on Mar 06, 2008 at 08:39 UTC |