On 15 Apr 2009, at 13:01, John W. Krahn wrote:
Dermot wrote:
2009/4/14 Chas. Owens <[email protected]>:
On Tue, Apr 14, 2009 at 11:49, Rick <[email protected]> wrote:
is it true that perl will be just as fast as c for reading files ?
for example
cow...@amans:~$ time cat /usr/share/dict/words | perl wc.pl
my $count = 0;
$/ = \4096;
while (<>) {
$count += tr/\n//;
}
print "$count\n";
That's a sneaky way to count lines :)
Not really. See the FAQ:
perldoc -q "How do I count the number of lines in a file?"
John,
How does one memorize the entire FAQ ?????
As you have no doubt done!
J
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/