#!/usr/bin/perl -w use strict; my @array; open(FILE, ") { chomp $_; push (@array, $_); $/= "####"; } close (FILE); my $i="0"; foreach (@array) { $i++; print "$i$_$i";}