fastkeys has asked for the wisdom of the Perl Monks concerning the following question:


OK, It's nearly midnight and this is really annoying me. I want to use split to change American date format to British

ie. yyyy-mm-dd to dd-mm-yyyy

code goes

sub changedate { my $year=0; my $month=0; my $day=0; ($year, $month, $day) = split(/-/, $_, 3); return $day."-".$month."-".$year; }

Problem is all I get back from it is --

I've tried escaping the - in the pattern match but to no avail. What have I missed?