#!/usr/bin/perl use warnings; use strict; my ($line,$i,$n,$emailtext); while( $line= ) { if( $line =~ m/^\*\*$/) { $emailtext .= if(*DATA); next if ( $line =~ m/^\*\*$/ ); } } print "$emailtext\n"; # you could start your print MAIL # stuff here. __DATA__ ** She turned me into a newt! ** One day, a shell shall emerge from the masses, written in Perl, and it will be Good. ** A newt?! ** The people will rejoice, and it shall be dubbed 'SuperShell'. ** I got better. **