> > Subject: How to get 1st line, last line and no of lines in a file > > is there any perl functions available for that ? > > suppose, if file have millions of records,
ok.... If it's a small file, try Tie::File by (I believe) Mark Jason Dominus. It's very cool. For a big file, I'm not sure there's a better way than to just run through and count lines as you go....and I don't just mean for Perl. Lines are delimited by newline characters, and can be of varying lengths, so how else would you could them? You could do something like reading the whole file in by blocks and using m// or tr/// to count the newlines, but that's still pretty intensive. __________________________________________________ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]