"Robert A. Decker" <comrade@umich.edu> writes: >Is there a simple Perl command for counting the number of lines in a >document? I can't seem to find one. If there isn't, can someone give me a >quick routine? I'm new to this, and I'm not sure how it would be done (I >suspect one would search for the number of instances of the "return" >character in the document). If you need to perform other operations on the file, it's probably easiest to use the value of $. after processing the file. Otherwise, do something like: undef $/; $f = <>; $count = ($f =~ tr/\n//); Matthias ----- Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri "[...] she scrutinized the form without comment and stamped the back. ``It will take approximately six weeks to process,'' she said. ``Six weeks!'' I said. ``Hitler could have invaded the entire empire by then.'' ``In that case, you'll very likely have to file a different form.''" -- Connie Willis, _Jack_