DEV Community

Discussion on: Daily Coding Puzzles - Nov 11th - Nov 16th

Collapse
 
choroba profile image
E. Choroba

Perl solution, test included:

#! /usr/bin/perl
use warnings;
use strict;

sub count_without_5 {
    my ($from, $to) = @_;
    return scalar grep $_ !~ /5/, $from .. $to
}

use Test::More tests => 2;
is count_without_5(1,9), 8;
is count_without_5(4,17), 12;