Richard müller wrote:
> 
> Hi,

Hello,

> I'm a very newbie with perl. I have a text file and want to read it line
> by line and split it into words:

It depends on how you define "words".


> my @fields = split / /, $_;
> - so far no problem.

Are you sure?  Using "split / /, $_" does not do what you seem to think
it does.  Better to use split with no arguments.

my @fields = split;


> Now I have to count the words in the line. This I could not achieve.
> I#m sure it is very simple - but I did not find the suitable command

my $count = @fields;


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to