#!/usr/bin/perl -- use warnings; use strict; my $test; my @words; #~ open(INFO,"<","testing.pl")||die"Can't open file:$!\n"; open(INFO,"<", __FILE__ )||die"Can't open file:$!\n"; chomp (@words=); close(INFO); foreach (@words){ if(/^\$ NAME : corry/ .. /\.EON/){ $test=$_; print $test; } } __END__ $ NAME : corry $$.Inc s d $$.Oc s $$.TO G1 ty n1 EE EE M T1 T2 $$SRU G2 n1 y OO OO M T3 T4 $$SRU .EON $ NAME : patrick $$.Inc c d $$.Oc c $$.TO G1 td n3 EE EE M T5 T6 $$SRU G2 n3 y OO OO M T7 T8 $$SRU .EON