use strict; use warnings; my ($title, $name, $format, $matches, $runs); format DATA2_TOP= @||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| $title ============================================================ Name Format of match matches played runs scored ============================================================ . format DATA= @<<<<<<<<<<<<<<<< @<<<<<<<<< @######### @######## $name, $format, $matches, $runs . my @array = ; $~ = 'DATA2_TOP'; $title = 'Records/Data of the trio'; write; $~ = 'DATA'; foreach (@array) { chop; ($name, $format, $matches, $runs) = (split(/!/)); write ; } __DATA__ sachin tendulkar!ODI!434!12000 sachin tendulkar!Test!246!10900 sachin tendulkar!T20!189!5000 sourav ganguly!ODI!334!8000 sourav ganguly!Test!235!5000 sourav ganguly!T20!124!1800 rahul dravid!ODI!387!9000 rahul dravid!Test!212!5980 rahul dravid!T20!43!1345