#!/usr/bin/perl -w use strict; my $doc =< AASDFG
9999999999
India
Yes FORM my @pairs = ($doc =~ m~\s*(.*?)\s*<~g); while (@pairs) { my ($field, $value) = splice(@pairs,0,2); printf "%-15s %s\n", $field, $value; } __END__ Emp ID: AASDFG Mobile Num: 9999999999 location: India Inservice: Yes