At 02:58 PM 2/8/2007 -0800, John Townsend wrote:
>I'm looking for a way to read the end of a file quickly. I have scripts
>that generate PostScript files (basically really large text files). I'd
>like to verify that each PostScript file ends with "%EOF". Rather than
>read the entire text file into memeory then parsing each line, I'd like
>to read from the bottom the file and search for the "%EOF" string.

Hi.

open FILE, "megafile.ps" or die;
seek FILE, -4, 2;
read FILE, $buffer, 4;
($buffer eq '%EOF') ? print "valid postscript" : print "invalid postscript";



--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede malis"

00000100

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to