Tell Perl that your records are terminated by "
.EON\n\n".
use Modern::Perl;
{
local $/ = ".EON\n\n";
while ( my $record = <DATA> ) {
say "I found: $record";
# ... now do something with $record ...
}
}
__DATA__
$ 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
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog:
Imperial Deltronics