in reply to Re: Re: taking sections out of a file and put it in an array
in thread taking sections out of a file and put it in an array

Check juo's example, there will be more data after the $ so you'll need to leave of the second $ (as davorg did) or it won't match.

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.