And what does the beginning of @infile look like?
Update: you can't use @infile the way you are; you would need to say:
@sections = split /\n\n/, join("", @infile);since split is expecting a scalar to split. Or slurp the whole file into a $infile and use that in the split. Or just assign to sections in the first place:
open(IN,"./$file");
{
local $/ = "\n\n";
chomp(@sections = <IN>);
}
close(IN);
(See
perlvar for what $/ does.)