in reply to rewinding an input filehandle

I think perldoc -f seek
should help you out