Files to read spw592341.dataA spw592341.dataB spw592341.dataC spw592341.dataD After reading first line $rhFiles = { 'spw592341.dataB' => { 'handle' => bless( \*Symbol::GEN1, 'IO::File' ), 'buffer' => 'spw592341:dataB:line1' }, 'spw592341.dataD' => { 'handle' => bless( \*Symbol::GEN3, 'IO::File' ), 'buffer' => 'spw592341:dataD:line1' }, 'spw592341.dataA' => { 'handle' => bless( \*Symbol::GEN0, 'IO::File' ), 'buffer' => 'spw592341:dataA:line1' }, 'spw592341.dataC' => { 'handle' => bless( \*Symbol::GEN2, 'IO::File' ), 'buffer' => 'spw592341:dataC:line1' } }; All files read again $rhFiles = { 'spw592341.dataB' => { 'handle' => bless( \*Symbol::GEN1, 'IO::File' ), 'buffer' => 'spw592341:dataB:line2' }, 'spw592341.dataD' => { 'handle' => bless( \*Symbol::GEN3, 'IO::File' ), 'buffer' => 'spw592341:dataD:line2' }, 'spw592341.dataA' => { 'handle' => bless( \*Symbol::GEN0, 'IO::File' ), 'buffer' => 'spw592341:dataA:line2' }, 'spw592341.dataC' => { 'handle' => bless( \*Symbol::GEN2, 'IO::File' ), 'buffer' => 'spw592341:dataC:line2' } }; Read third file in list $rhFiles = { 'spw592341.dataB' => { 'handle' => bless( \*Symbol::GEN1, 'IO::File' ), 'buffer' => 'spw592341:dataB:line2' }, 'spw592341.dataD' => { 'handle' => bless( \*Symbol::GEN3, 'IO::File' ), 'buffer' => 'spw592341:dataD:line2' }, 'spw592341.dataA' => { 'handle' => bless( \*Symbol::GEN0, 'IO::File' ), 'buffer' => 'spw592341:dataA:line2' }, 'spw592341.dataC' => { 'handle' => bless( \*Symbol::GEN2, 'IO::File' ), 'buffer' => 'spw592341:dataC:line3' } }; Read spw592341.dataD $rhFiles = { 'spw592341.dataB' => { 'handle' => bless( \*Symbol::GEN1, 'IO::File' ), 'buffer' => 'spw592341:dataB:line2' }, 'spw592341.dataD' => { 'handle' => bless( \*Symbol::GEN3, 'IO::File' ), 'buffer' => 'spw592341:dataD:line3' }, 'spw592341.dataA' => { 'handle' => bless( \*Symbol::GEN0, 'IO::File' ), 'buffer' => 'spw592341:dataA:line2' }, 'spw592341.dataC' => { 'handle' => bless( \*Symbol::GEN2, 'IO::File' ), 'buffer' => 'spw592341:dataC:line3' } }; After closing all files $rhFiles = { 'spw592341.dataB' => { 'buffer' => 'spw592341:dataB:line2' }, 'spw592341.dataD' => { 'buffer' => 'spw592341:dataD:line3' }, 'spw592341.dataA' => { 'buffer' => 'spw592341:dataA:line2' }, 'spw592341.dataC' => { 'buffer' => 'spw592341:dataC:line3' } };