Well I actually don't use chomp anymore, I can't really explain it but I have come across files that just didn't agree with chomp. So I use...
$string =~ s/^\s+//; $string =~ s/\s+$//;
To remove any whitespace(including newlines) before the first character and after the last character on the line, as well as...
@fi = split(/\s+/, $nextline);
... to break apart the line by spaces.
This whole issue I was having actually initiated with my while loop being constructed with...
while(@fi[0] eq'') { $nextline = readline<IN>; //remove whitespace //split the line, but I think I included my accidentally so that +I had my @fi = split..... }
...so that I also changed my scope inside the while loop accidentally by using...
my $nextline = ...instead of...
$nextline = ...In reply to Re^3: While loop conditions in Perl
by joemaniaci
in thread While loop conditions in Perl
by joemaniaci
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |