diff options
Diffstat (limited to 'perl/p4.pl')
-rwxr-xr-x | perl/p4.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perl/p4.pl b/perl/p4.pl new file mode 100755 index 0000000..9982fa5 --- /dev/null +++ b/perl/p4.pl @@ -0,0 +1,18 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use List::Util qw(max); + +# Functional + +# Imperative +my $resp; +for my $x (100 .. 999) { + for my $y ($x .. 999) { + my $cand = $x*$y; + $resp = max($resp, $cand) if $cand eq reverse($cand); + } +} +print "$resp\n"; |