Help for this page

Select Code to Download


  1. or download this
    open(IN, $oneper) or die "Can't open file $oneper for reading: $!\n";
    open(INDEX, "+>$file.idx") or die "Can't open $file.idx for read/write
    +: $!\n";
    ...
            $offset = tell($data_file);
        }
    }
    
  2. or download this
    # usage: line_with_index(*DATA_HANDLE, *INDEX_HANDLE, $LINE_NUMBER)
    # returns line or undef if LINE_NUMBER was out of range
    ...
        seek($data_file, $d_offset, 0);
        return scalar(<$data_file>);
    }