What am I doing wrong?Enable warnings (Tip #1 from Basic debugging checklist). This will show that you are using the wrong equality operator. I have added code to make yours runnable (and used perltidy):
use warnings; #use strict; use Getopt::Long; $result = GetOptions( "OIMID=s" => \$oimid, ); sub StingtoNum() { if ( $oimid eq "Google" ) { return "01"; } elsif ( $oimid eq "DELL" ) { return "02"; } else { return "00"; } } sub Add() { $oim = &StingtoNum; $version = "00"; $sum = $oim . $version; print "$sum"; } Add(); print "\n";
In reply to Re: calling a subroutine from another subroutine
by toolic
in thread calling a subroutine from another subroutine
by abcdefg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |