An interesting but fragile technique is to alter the input record seperator $/:
use strict; use warnings; local $/ = "Window "; while (<DATA>) { chomp; next if ! length; my $paragraph = $/ . $_; print "$paragraph\n"; } __DATA__ Window 0x800022: Machine: genus Name: xterm Icon Name: xterm Command: xterm -u8 -geometry 156x62+190+-2 Instance/Class: xterm/XTerm Window 0xc00022: Machine: genus Name: ~ Icon Name: psh Command: xterm -e /usr/bin/psh Instance/Class: xterm/XTerm Window 0xe00001: Machine: genus Name: Gecko Icon Name: mozilla-bin Command: mozilla-bin Instance/Class: mozilla-bin/Mozilla-bin
Prints:
Window 0x800022: Machine: genus Name: xterm Icon Name: xterm Command: xterm -u8 -geometry 156x62+190+-2 Instance/Class: xterm/XTerm Window 0xc00022: Machine: genus Name: ~ Icon Name: psh Command: xterm -e /usr/bin/psh Instance/Class: xterm/XTerm Window 0xe00001: Machine: genus Name: Gecko Icon Name: mozilla-bin Command: mozilla-bin Instance/Class: mozilla-bin/Mozilla-bin
In reply to Re: Reading chunks of text
by GrandFather
in thread Reading chunks of text
by Hue-Bond
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |