in reply to split based upon string

Changing the $/ variable to the value of "DELIMITING_TEXT" would make the "DELIMITING_TEXT" be removed by chomp when reading in, however, read perlvar to see caveats involving "$/"... when printing this array, each element of the array can be spread on some new lines because "\n" wasn't used as the line separator while reading the data in...
#!/usr/local/bin/perl use strict; use warnings; local $/ = "DELIMITING_TEXT"; my @array; while(<DATA>){ chomp; push @array, $_; } foreach my $element(@array){ print "$element"; # no "\n" is typed } __DATA__ some junk DELIMITING_TEXT test1 test2 test3 test4 DELIMITING_TEXT test1 test2 test1 test2 test1 test2 DELIMITING_TEXT test1 test2 DELIMITING_TEXT some junk


Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.