diff options
| author | Paulo Custodio <pauloscustodio@gmail.com> | 2021-01-26 23:31:20 +0000 |
|---|---|---|
| committer | Paulo Custodio <pauloscustodio@gmail.com> | 2021-01-26 23:31:20 +0000 |
| commit | 8f7f5c93def45398db496f35e7921cfe0d264d1d (patch) | |
| tree | 7f141de93b08d38f0e5fc5930ec93fc4ef311638 /challenge-095 | |
| parent | 8902910406fe11ec55932be70d1df508f61c083d (diff) | |
| download | perlweeklychallenge-club-8f7f5c93def45398db496f35e7921cfe0d264d1d.tar.gz perlweeklychallenge-club-8f7f5c93def45398db496f35e7921cfe0d264d1d.tar.bz2 perlweeklychallenge-club-8f7f5c93def45398db496f35e7921cfe0d264d1d.zip | |
Remove List::Util and Data::Dump dependencies
Diffstat (limited to 'challenge-095')
| -rw-r--r-- | challenge-095/paulo-custodio/perl/ch-2.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/challenge-095/paulo-custodio/perl/ch-2.pl b/challenge-095/paulo-custodio/perl/ch-2.pl index c2cf2ae54c..b3eace4cb3 100644 --- a/challenge-095/paulo-custodio/perl/ch-2.pl +++ b/challenge-095/paulo-custodio/perl/ch-2.pl @@ -27,13 +27,20 @@ use 5.030; { package Stack; - use List::Util; sub new { my($class) = @_; return bless [], $class; } sub push { my($self, $n) = @_; push @$self, $n; } sub pop { my($self) = @_; pop @$self; } sub top { my($self) = @_; return $self->[-1]; } - sub min { my($self) = @_; return List::Util::min(@$self); } + sub min { my($self) = @_; return min_(@$self); } + + sub min_ { + my($min, @a) = @_; + for (@a) { + $min = $_ if $min > $_; + } + return $min; + } } my $stack = Stack->new; |
