Mega Code Archive

 
Categories / Perl / Language Basics
 

Read lines from supplied filenames

#!/usr/bin/perl use warnings; use strict; my @words; while (<>) {    # read each line into $_ in turn    push @words, split; # split $_ into words and store them } print "Found ", scalar(@words), " words in input \n";