open DATA, "junk.txt" or die $!;
my @arr;
while (<DATA>) {
# add the extra $ and it won't print anything
push @arr, $1 if /\$FILES(.*?)\$/;
}
close DATA;
print $_, "\n" for @arr;
Try it out.
Update: I think I misinterpreted Chief of Chaos's post. If you want to ensure there's no data before the $FILE or after the $ then he is correct.
Update: If you want each CSV as an individual array element, substitute the push line above with:
push @arr, split(/, /, $1) if /\$FILES(.*?)\$/;
Otherwise they'll all read into one element. |