Hi,
when you get $s from STDIN, it comes along with a newline,
so try something like:  chomp($s = <STDIN>);
A+

Gajo Csaba a écrit :
> 
> Hi, I have a problem with SWITCH. I wrote this, I think
> it's clear to anzone what it should do:
> 
> print "Type in a number 1-5: ";
> $s = <STDIN>;
> SWITCH;
> {
>  if ($s == 1) { print "one\n"; last SWITCH; }
>  if ($s == 2) { print "two\n"; last SWITCH; }
>  if ($s == 3) { print "three\n"; last SWITCH; }
>  if ($s == 4) { print "four\n"; last SWITCH; }
>  if ($s == 5) { print "five\n"; last SWITCH; }
> }
> 
> And I get an error message saying "Label not found
> for "last SWITCH" at line 11. <STDIN> chunk 1." (with line
> 11 being the first line of the chunk)
> 
> So what's wrong?
> 
> Also, how can I do something like in bash, where I have
> options 1), 2)... and also *). That is, how can I do that
> *) thing? :)
> 
> Thanks, Csaba
> 
> --
> 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]

Reply via email to