aboutsummaryrefslogtreecommitdiff
path: root/challenge-083/andinus/perl/ch-1.pl
blob: fe09b8cb1838fa7b717fe704ced8a8d3bfd3f33b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

use strict;
use warnings;

die "usage: ./ch-1.pl <string with 3 or more words>\n"
    unless scalar @ARGV == 1
    and scalar split(/ /, $ARGV[0]) >= 3;

my @words = split / /, $ARGV[0];
shift @words;
pop @words;

my $len;
$len += length($_) foreach @words;

print $len, "\n";