Where can i find more info on seek(), perldoc does not tell me much. it only list 3 parameters, where David uses 4 in this code? what do negative values in the offset represent?
Thanks > > #!/usr/bin/perl -w > use strict; > > my @character; > my @lines; > open(FH,"foo.txt") || die $!; > seek(FH,(-s "foo.txt")-2,0); > while(1){ > > read(FH,$b,1); > > if($b eq "\n"){ > unshift(@lines,join('',@character) . "\n"); > @character = (); > last if(@lines == 5); > }else{ > unshift @character,$b; > } > > seek(FH,tell(FH)-2,0); > next unless(tell(FH) == 1); > > read(FH,$b,1); > unshift @character,$b; > > seek(FH,0,0); > read(FH,$b,1); > unshift @character,$b; > > print join('',@character),"\n"; > last; > } > close(FH); > > #-- last 5 lines > print join('',@lines); > > __END__ > > david > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]