$my counter = 0; while ( <> ) { $counter ++; print; }