On 15 Apr 2009, at 13:01, John W. Krahn wrote:

Dermot wrote:
2009/4/14 Chas. Owens <chas.ow...@gmail.com>:
On Tue, Apr 14, 2009 at 11:49, Rick <rich.j...@gmail.com> 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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to