http://www.perlmonks.org?node_id=980363

abcdefg has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perlmonks, I am stuck with a very basic thing in perl code being newbie to coding.

my $usage = " Usage: $scriptname (-type<type> -OIMID <oimid> -version <version_numbe +r> -out <filename> ) -type <type> :A|B -version <version_number> :Required.Minimum Security Versio +n Number. -OEMID <oemid> : Required. -out <filename> : Required. "; my %opts; $result = GetOptions ("type=s" => \$type, "version=i" =>\$version_number, "OIMID=s" =>\$oimid, "out=s" => \$filename); if ($type eq "A"){ &Add() ; } elsif ($t eq "B"){ &Sub(); } else { die "Unhandled option.\n"; } sub StingtoNum() { if ($oimid = "Google") { return "01"; } elsif ($oimid = "DELL") { return "02"; } else { return "00"; } } sub Add() { $oim = &StingtoNum; $zero="00" $Version_Info = $oim.$zero.$version_number; } $
Now when i run this program,inspite of whatever I give the value of oimid in commandline,it takes the value of oim in Add as "01".I expect if I give oimid as dell it should give 02 for oim. What am I doing wrong? Thanks in Advance for help.