Thanks Charles,
I got what I wanted to work by replacing while with for.
--Teresa
Charles K. Clarkson wrote:
T Raymond <mailto:[EMAIL PROTECTED]> wrote:
: If there is a word in $words[$n], is the following expression for
: while valid? --Teresa
Define "valid".
We can test the _syntax_: I get "a.pl syntax OK".
#!/usr/bin/perl -c
use strict;
use warnings;
my @words = split ' ', 'The quick brown fox';
my @letters;
my $n = 1;
while ( $words[$n] ) {
@letters=split//;
}
__END__
Do you want to know if the while loop is endless? Yes it is.
$words[$n] will always evaluate true until we do something to it
to make it evaluate to not true.
But these are things you could have tried yourself. So what
do you mean by "valid"?
HTH,
Charles K. Clarkson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>