C:\Users\Bill\forums\monks>type results.bat @echo off echo Student Name = Harry echo Student Code = student_id_1 echo Exam Status = PASSED echo ------------------------------------- echo Student Name = Mike echo Student Code = student_id_2 echo Exam Status = PASSED echo ------------------------------------- echo Student Name = Tom echo Student Code = student_id_3 echo Exam Status = PASSED echo ------------------------------------- C:\Users\Bill\forums\monks>type sreek350_2.pl #!perl -n use strict; use warnings; BEGIN{ unshift @ARGV, "results.bat |" } next unless /^(Student Name|Exam Status) +\= (.*)$/; printf "%-8s", $2; printf "\n" if ($1 eq 'Exam Status'); C:\Users\Bill\forums\monks>perl sreek350_2.pl Harry PASSED Mike PASSED Tom PASSED C:\Users\Bill\forums\monks>