#!/usr/local/bin/perl5 -w
# a solution to 2.2

$n_lines = $n_chars = $n_words = 0;
while(<>)
{
    $n_lines++;
    $n_chars += length;
    @words = split;
    $n_words += scalar @words;
}
print "$n_lines  $n_words  $n_chars\n";	# or "lines $n_lines ..."

# Note: the ++ operator is willing to start from an undefined
#   value (treating it as 0), but += is not willing.
