diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-08-13 09:30:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-13 09:30:31 +0100 |
| commit | ab045ec199743bf79bb05c7e2666d357dda9579b (patch) | |
| tree | ea4ca77562cef623c49e3b368ab8422d3e759ec2 | |
| parent | 5624769dd99154cc6f0b7a4d931fc371e87605e4 (diff) | |
| parent | 21248450bfbf469f23c163ea9e4b8d9439d56ce2 (diff) | |
| download | perlweeklychallenge-club-ab045ec199743bf79bb05c7e2666d357dda9579b.tar.gz perlweeklychallenge-club-ab045ec199743bf79bb05c7e2666d357dda9579b.tar.bz2 perlweeklychallenge-club-ab045ec199743bf79bb05c7e2666d357dda9579b.zip | |
Merge pull request #4705 from wlmb/challenges
Fix eval, add comments
| -rwxr-xr-x | challenge-125/wlmb/perl/ch-1.pl | 4 | ||||
| -rwxr-xr-x | challenge-125/wlmb/perl/ch-2.pl | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/challenge-125/wlmb/perl/ch-1.pl b/challenge-125/wlmb/perl/ch-1.pl index 013c275aff..24b829e36d 100755 --- a/challenge-125/wlmb/perl/ch-1.pl +++ b/challenge-125/wlmb/perl/ch-1.pl @@ -23,8 +23,8 @@ foreach(@ARGV){ } } say "Input; $_\nOutput:"; - say "\t$_" foreach uniq map { - my($A,$B,$K)=@$_; + say "\t$_" foreach uniq map { #remove duplicates + my($A,$B,$K)=@$_; # careful not to confuse with $a and $b from sort my ($x, $y, $z)=sort {$a <=> $b} map {$K*$_} ($A**2-$B**2, 2*$A*$B, $A**2+$B**2); "\t($x, $y, $z)"; } @found; diff --git a/challenge-125/wlmb/perl/ch-2.pl b/challenge-125/wlmb/perl/ch-2.pl index 0038bf556b..bf1435526e 100755 --- a/challenge-125/wlmb/perl/ch-2.pl +++ b/challenge-125/wlmb/perl/ch-2.pl @@ -11,7 +11,7 @@ use List::Util qw(max); foreach(@ARGV){ die("Only []0-9, and spaces allowed") unless m/^([][0-9,\s])*$/; my $tree_as_array=eval $_; - warn("eval failed @!"), next if @!; + warn("eval failed $@"), next if $@; my $tree_as_hash=make_tree($tree_as_array); my @path=(reverse(path($tree_as_hash->{head}{left})), $tree_as_hash->{head}{value}, path($tree_as_hash->{head}{right})); |
