RE: how to match the last line in a file

2003-06-20 Thread francois Bourgneuf
You can read the file starting from the last record. @file = reverse FILE; [EMAIL PROTECTED]; bour9 -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoye : jeudi 19 juin 2003 22:59 A : [EMAIL PROTECTED] Objet : Re: how to match the last line in a file -

Re: how to match the last line in a file

2003-06-19 Thread Dave Crawford
Do you only need the last line or are you processing each line of the file? If you only need the last line you can use: while (READIN) { $last = $_; } # ... perform your match on $last here -Dave - Original Message - From: Grace Huang [EMAIL PROTECTED] To: [EMAIL PROTECTED]

RE: how to match the last line in a file

2003-06-19 Thread FARRINGTON, RYAN
Title: RE: how to match the last line in a file could you not also do open(FILE, file_for_read.txt); @array = FILE; $last_line_number = $#array; $last_line = $array[$last_line_number]; ?? you may have to add one or subtract one I can't remember =) -Original Message- From: Dave

RE: how to match the last line in a file

2003-06-19 Thread Matthew R. Hamilton
You could do that but if the file is VERY large it can take up quie a bit of memory to hold the whole file in the array. Matthew --- FARRINGTON, RYAN [EMAIL PROTECTED] wrote: could you not also do open(FILE, file_for_read.txt); @array = FILE; $last_line_number = $#array; $last_line =

RE: how to match the last line in a file

2003-06-19 Thread Jason Rush
Title: RE: how to match the last line in a file Another possibility is to begin by appending a known unique new last line, testing for it each time, and quitting when you reach it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of FARRINGTON,

Re: how to match the last line in a file

2003-06-19 Thread Michael Higgins
- Original Message - From: Grace Huang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 3:16 PM Subject: how to match the last line in a file Hi I use while (my $line = READIN) {...} to read a file, how can I determine if a line is the last line in the file since I