in reply to Regarding Declaring Variables

Hi Tech77 !!

This is another way to do the same program, though Grandfather had given a better one i guess..

use strict; use warnings; my $no=12; my $target; do { print "Guess the number : "; chomp($target = <STDIN>); print "$target is too low\n" if ($target < $no); print "$target is too high\n" if ($target > $no); } until ( $target == $no);

Thank you

A perl Script without 'strict' is like a House without Roof; Both are not Safe;

Replies are listed 'Best First'.
Re^2: Regarding Declaring Variables
by Tech77 (Novice) on Nov 17, 2005 at 15:40 UTC
    Thank you to vishi83 and GrandFather for the help! Also, to Delusional for the randomization. That's a little more advanced that where I am now, but I'll get there! Your explanations really helped me understand what's going on with my code!