ansabhailte has asked for the wisdom of the Perl Monks concerning the following question:
$m{$_} = ++$i for qw[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec]; ($a, $t, $f, $b) = qw[([A-Za-z]+) \b(\d\d)\b (\d{4}) (\d{4}|\d\d)]; for (<>) { ($y, $m, $d) = /$f-$t-$t/ ? ($1, $2, $3) : /$t\/$t\/$t/ ? ($3, $1, $2) : /$t#$t#$t/ ? ($2, $1, $3) : /$t\*$t\*$f/ ? ($3, $2, $1) : /$a $t, $b/ ? ($3, $m{$1}, $2) : next; $y += $y < 50 ? 2000 : $y < 100 ? 1900 : 0; printf "%04d-%02d-%02d\n", $y, $m, $d; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help me understand this code?
by aaron_baugher (Curate) on May 21, 2015 at 22:19 UTC | |
by ansabhailte (Novice) on May 21, 2015 at 22:25 UTC | |
|
Re: Help me understand this code?
by ww (Archbishop) on May 21, 2015 at 21:34 UTC | |
by ansabhailte (Novice) on May 21, 2015 at 22:24 UTC | |
by Anonymous Monk on May 21, 2015 at 22:44 UTC | |
by ansabhailte (Novice) on May 21, 2015 at 22:52 UTC | |
by Laurent_R (Canon) on May 22, 2015 at 06:27 UTC | |
| |
by AnomalousMonk (Archbishop) on May 22, 2015 at 08:50 UTC | |
| |
|
Re: Help me understand this code?
by GotToBTru (Prior) on May 21, 2015 at 20:40 UTC | |
by ansabhailte (Novice) on May 21, 2015 at 20:49 UTC | |
by GotToBTru (Prior) on May 21, 2015 at 21:11 UTC | |
by ansabhailte (Novice) on May 21, 2015 at 21:31 UTC | |
|
Re: Help me understand this code?
by Marshall (Canon) on May 22, 2015 at 06:52 UTC | |
by ansabhailte (Novice) on May 22, 2015 at 16:17 UTC |