Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Using switch
Re: Using switch
>> I want to use a switch .. case statement in my program.
>> I looked it up with 'perldoc switch' and found the help.
>> I tested some code from the perldoc switch help and it failed.
>> This is what I tried...
>> <PERL CODE>
>> use switch;
> On my system, the module is Switch.pm, not switch.pm. Case matters.
>> print("Enter a digit\n");
>> $var = <STDIN>; chop $var;
In addition, this seems a little more elegant:
chomp ($var = <STDIN>);
> not that it matters in this case, but you almost always want chomp()
> rather than chop(). Look them up to see why.
> Paul Lalli
- » help needed, Can't locate loadable object for module GMP--AIX
- — Previous thread in » PERL Discussions