Reading a line from a file without advancing the line counter with Perl -


i want able read "next line" without increasing line counter, next time read command isued read same line.

example:

this first line
this second line
this third line

i want able know second line says "this second line" not advancing counter program:

print <>; print unknown_read_command; print <>; 

will print on screen:

this first line
second line
second line

and in more general, how can change , move pointer line in direction , amount want?

you can fetch file position filehandle tell, , set seek:

my $pos = tell $fh; # ... seek $fh, $pos, 0 or die "couldn't seek $pos: $!\n"; 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -