On 08/22/2006 11:24 PM, [EMAIL PROTECTED] wrote:
Hi all,
I used to do this on UNIX scripts ...
#!/usr/bin/ksh
vowels="a e i o u"
for letter in $vowels
do
echo $letter
done
How do I do the same in Perl?
Is it possible to do this in Perl without having to put vowels into an array and
use foreach, i.e., using only a FOR-LOOP, but not necessarily having to hardcode
the ending number as for($start=1;$start<=5;$start++)? vowels may change into
letters="a b c d e f g h" in which case for($start=1;$start<=5;$start++) may
not be valid anymore.
Any feedback will be very much appreciated .... Thanks in advance ...
for my $letter (qw(a e i o u)) {
print $letter, "\n";
}
Take a look at "perldoc perl" and "perldoc perlsyn."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>