aboutsummaryrefslogtreecommitdiff
path: root/challenge-007
diff options
context:
space:
mode:
authorAdam Russell <ac.russell@live.com>2019-05-12 10:46:31 -0400
committerAdam Russell <ac.russell@live.com>2019-05-12 10:46:31 -0400
commita65c15b821211a5d79f6e68484456a4916045044 (patch)
tree393b6ce4623abd11649e3b5982401dcdd9f5c44f /challenge-007
parent5d3a52c4353dfc01a0b44e066bdd195891cd67d8 (diff)
downloadperlweeklychallenge-club-a65c15b821211a5d79f6e68484456a4916045044.tar.gz
perlweeklychallenge-club-a65c15b821211a5d79f6e68484456a4916045044.tar.bz2
perlweeklychallenge-club-a65c15b821211a5d79f6e68484456a4916045044.zip
finished part 2
Diffstat (limited to 'challenge-007')
-rw-r--r--challenge-007/adam-russell/perl5/ch-2.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/challenge-007/adam-russell/perl5/ch-2.pl b/challenge-007/adam-russell/perl5/ch-2.pl
index cc54bff791..c7f08f5fb5 100644
--- a/challenge-007/adam-russell/perl5/ch-2.pl
+++ b/challenge-007/adam-russell/perl5/ch-2.pl
@@ -36,12 +36,13 @@ sub build_graph{
sub dijkstra_sssp{
my($graph, $source) = @_;
my %paths;
- our %total_edges;
- sub by_total_edges {
+ my %total_edges;
+ no warnings "once";
+ local *by_total_edges = sub {
return 1 if $total_edges{$a} eq OO;
return -1 if $total_edges{$b} eq OO;
return $total_edges{$a} <=> $total_edges{$b};
- }
+ };
my @vertices = $graph->vertices();
foreach my $v (@vertices){
$total_edges{$v} = OO;