Ooops, I think I misunderstood the question in my last post. That will teach me to read the whole post first!
Anyway... What does that $where in your code come from? It is in the for() statement. Shouldn't it be $Ans? I would do it more like this... print "Enter the command: "; chomp(my $input = <STDIN>); for ($input) { /u/i and print "u\n" and last; /d/i and print "d\n" and last; # default print "default\n"; } ....You need the "and last", otherwise it will always execute the default. Rob -----Original Message----- From: Mark Goland [mailto:[EMAIL PROTECTED]] Sent: Friday, October 11, 2002 3:20 PM To: [EMAIL PROTECTED] Subject: switch Hi guys, I am trying to implement a switch statment in perl. I have tryed doing it 2 way's. For some reason my comparison statments are not working can some one please look over my code and see if they can point me on the right track ?? Thanx in advance, Mark Solution 1: while( ( $Remainder = ($P_lenght%16065) ) != 0 ) { print "\a size you gave is not multiple of cylenders\n"; print "round (U)p (D)own (R)enter ?"; $Ans=<>; # chomp ($Ans); print $Ans; for ($where){ /u/ && do{print "u\n";}; /d/ && do{print "d\n";}; # default print "enter partition length : "; chomp ( $P_lenght=<> ); } } _exit 0; solution 2: while( ( $Remainder = ($P_lenght%16065) ) != 0 ) { print "\a size you gave is not multiple of cylenders\n"; print "round (U)p (D)own (R)enter ?"; $Ans=<>; # chomp ($Ans); print $Ans; if( $Ans =~ /u/i ){ $P_lenght = ($P_lenght - $Remainder+$CYLLENGTH); } elsif( $Ans =~ /d/i){ $P_lenght-=$Remainder; } # default else{ print "enter partition length : "; chomp ( $P_lenght=<> ); } } _exit 0; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]