$, = $/; $a[$_] = ++$line while <>; print map $a[$_] || (), $[ .. $#a;