perl while loops -
i know how seek works generally, , have looked @ few other posts. still confused. how seek work exactly, read same position left off from?
while( $line= <in1>) { something; while( $l= <in2>) { something; seek in1, 0, 1; } } would go first loop , start left off...? , if went second while loop how readfrom left off...?
no, won't go anywhere. particular seek no-op, because, according seek documentation you're telling "move 0 bytes current position". if need note position in file , resume there, need tell , seek whence set seek_set (0).
example:
use fntl qw(seek_set); # <- knows seek_set on system, though 0, afair. $current_position = tell $file_handle; do_stuff_with_data_from(<$file_handle>); do_more_stuff_with_data_from(<$file_handle>); # rewind seek $fh, $current_position, seek_set;
Comments
Post a Comment