aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-279/robbie-hatley/perl/ch-1.pl12
1 files changed, 6 insertions, 6 deletions
diff --git a/challenge-279/robbie-hatley/perl/ch-1.pl b/challenge-279/robbie-hatley/perl/ch-1.pl
index cbdc28e882..8bfb44be55 100755
--- a/challenge-279/robbie-hatley/perl/ch-1.pl
+++ b/challenge-279/robbie-hatley/perl/ch-1.pl
@@ -50,7 +50,7 @@ Output is to STDOUT and will be each input followed by the corresponding output.
use v5.36;
use List::MoreUtils 'zip6';
- sub sort_letters ($letters, $weights) {
+ sub sort_letters :prototype(\@\@) ($letters, $weights) {
join '',
map {$$_[0]}
sort {$$a[1]<=>$$b[1]}
@@ -87,11 +87,11 @@ my @arrays = @ARGV ? eval($ARGV[0]) :
# MAIN BODY OF PROGRAM:
$"=', ';
for my $aref (@arrays) {
- my $letters = $$aref[0];
- my $weights = $$aref[1];
- my $word = sort_letters($letters,$weights);
+ my @letters = @{$$aref[0]};
+ my @weights = @{$$aref[1]};
+ my $word = sort_letters(@letters,@weights);
say '';
- say "letters = (@$letters)";
- say "weights = (@$weights)";
+ say "letters = (@letters)";
+ say "weights = (@weights)";
say "Sorted letters = $word";
}