Friday, February 4, 2011

PERL : While Loop

pico whileloop1.pl
#!/usr/bin/perl -w
$value1 = 1;
$value2 = 2;
while ($value1 <= $value2)
{
print $value1;
$value1 += 1;
}
#end
perl -w whileloop1.pl


#!/usr/bin/perl -w
$value1 = 1;
$value2 = 22;
until ($value2 <= $value1)
{
print $value2\n;
$value2 -= 1;
}
#end

No comments:

Post a Comment