in reply to Re: Re: Re: What's the best way to do a pattern search like this?
in thread What's the best way to do a pattern search like this?
everything is outstanding, BUT the function also calculated the blank lines between the paragraphs. It outputed something like:open (FILE, "file.txt") || die "Can't open data file."; while (<FILE>) { @array_codes = split /\W+/; foreach $code_key (@array_codes) { $codes{$code_key}++; } } printf "$_\t$codes{$_}\n" for keys %codes;
I tried s/\n/ /g, but it still counted the blank lines. How do I get rid of the blank lines in a txt documents, and relace them with a space? Or there is a way to not count the blank lines? Thank you very very much...12 ab 42 aba 25 .......
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: What's the best way to do a pattern search like this?
by tachyon (Chancellor) on Jul 20, 2001 at 14:59 UTC |