printf "%20s %s\n", 'job_type', '#'; while () { my ($job_type, $job_number) = /job: "(\D+)(\d*)"\s*$/ or next; printf "%20s %s\n", $job_type, $job_number; } __DATA__ Prefatory remarks, job: "Testing01" More remarks, job: "mymusic" Other stuff, job: "myimages2" #### job_type # Testing 01 mymusic myimages 2