in reply to Re: text reformatting woes
in thread text reformatting woes

How are you printing @sections and getting 4881? What does this show:
use Data::Dumper; print Dumper \@sections;

Replies are listed 'Best First'.
Re: Re: Re: text reformatting woes
by Anonymous Monk on Apr 19, 2004 at 08:04 UTC
    i run the script with the -d flag, and after the split() line, i type "print @sections" in the debugger. then it prints out "4811"
      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.)