in reply to Correct pathway to a file
Dear Monk,
Are you actually reading the replies you get or are you causing me to waste my time? If you actually read my replies to your previous posting on this subject you'd have the answer.
Does this ring a bell?
sub countWords { # Path and filename are passed to this sub. Join the two for the fu +lly # qualified path name. my $fname=join("/",@_); open FIN,"< $fname" or die "$fname:$!"; my @lines=<FIN>; chomp @lines; close FIN; my $count=0; foreach my $line(@lines){ map { $count++ } split (/[\s\t\n]+/,$line); } printf "There are %d words in %s\n",$count,$fname; }
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Correct pathway to a file
by Dr Manhattan (Beadle) on Jan 10, 2013 at 19:26 UTC | |
by blue_cowdawg (Monsignor) on Jan 10, 2013 at 19:45 UTC |
In Section
Seekers of Perl Wisdom