#! /usr/bin/perl $line = <>; print "$line"; $lc=0; while (<>) { $lc++; while ( / (\d*)/g ){ print " $lc $1\n"; } }