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 :) It might be worth pointing out that there are there are several text modules that contain '_XS' in their name, such as Text::CSV_XS what parse the file in C if your OS will support it, otherwise they use pure perl. I am not as scientific as Chas so I will "guess" that modules that use C will be faster. Dp. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/