in reply to Re^2: parsing question
in thread parsing question
This sets the default line-separator (held in "$/", normally set to "\n") to undef, so that whatever comes in from STDIN (<>) will get slurped up, split on the string "-{103}", and assigned to @sections.
A short example... put the following into a script named "test.pl":
#!/usr/bin/perl -w use strict; my @sections = split 'FOO', do {local $/; <>}; close *ARGV; print join("\n", @sections);
Then, put the following into a file called "test.txt":
FOObarFOObarFOObarFOObarFOObar FOObarFOObarFOObarFOObarFOObar FOObarFOObarFOObarFOObarFOObar
Then, run the following at the command-line:
cat test.txt | ./test.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: parsing question
by smist (Acolyte) on Dec 07, 2006 at 17:42 UTC |