my $i=0; open (FILE, "pdftotext -layout multipage.pdf - |"); while() { $i++; my($line) = $_; print "\n
$i
$line
"; } close FILE;