Skip to content

Commit e92eaea

Browse files
committed
Challenge-048 solutions by saiftynet submitted using EZPWC
1 parent de551f9 commit e92eaea

File tree

1 file changed

+2
-2
lines changed
  • challenge-048/saiftynet/perl

1 file changed

+2
-2
lines changed

challenge-048/saiftynet/perl/ch-2.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
die 'Invalid string, must be "MDY", "DMY" or "YMD"' if $format !~/^MDY|DMY|YMD\b/;
2929

3030
foreach my $yyyy (2000..2999){
31-
my $mm = substr($yyyy,3,1).substr($yyyy,2,1);
32-
my $dd = substr($yyyy,1,1).substr($yyyy,0,1);
31+
my $mm = reverse substr($yyyy,2,2);
32+
my $dd = reverse substr($yyyy,0,2);
3333

3434
($mm,$dd)=($dd,$mm) if $format eq "DMY"; # Swap if DDMMYYY required
3535

0 commit comments

Comments
 (0)