#!perl use strict; use warnings; while (<DATA>) { if (my ($bbegin) = /^(=+KEYWORD \d+)/) { my $block_o_text; while (1) { $_ = <DATA>; /^${bbegin}_END/ ? last : ($block_o_text .= $_); } print "Do something with $block_o_text\n"; } } __DATA__ ========KEYWORD 1=========== Text text text ========KEYWORD 1_END======= ========KEYWORD 2=========== Text text text ========KEYWORD 2_END======= ========KEYWORD 3=========== Text text text ========KEYWORD 3_END=======
In reply to Re: Reading chunks of data and then working on it
by Roy Johnson
in thread Reading chunks of data and then working on it
by legend
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |