Would this not work for you? This way you would only have a portion of the file in memory...
Shawn # UNTESTED use strict; open(FILE,'some_file.txt') or die "Can't open some_file.txt: $!\n"; my $state = 0; my $buffer = "; while (<MYFILE>) { $buffer.=$_; if (/^\*+/) { # this is the *** line dispatch($state, $buffer); undef $buffer; $state = 1; next; } elsif (/^=+/) { # this is a "trail" line dispatch($state, $buffer); undef $buffer; $state = 2; next; } } # run the last section dispatch($state, $buffer); sub dispatch { my ($state, $buffer) = @_; return unless ( $state ); # skip begining of file to first section if ( $state == 1 ) { fooSub($buffer); } elsif ( $state == 2 ) { trialSub($buffer); } } sub fooSub { # do stuff } sub trialSub { # do stuff } > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]