Hello I have written a perl code using nested if statements but i want to use switch function insted of nestedif
#!/usr/bin/perl
print "Enter the Integers";
my $Integers =<>;
my @numbers =split(',',$Integers);
$numofint =scalar(@numbers );
@oldarray=0;
foreach my $num (@numbers)
{
is_inum($num);
print "@letters"
}
sub is_inum
{
print "$num\n";
my ($inum)=shift(@_);
if ($inum == 2)
{
@letters = (a,b,c);
return @letters;
}
elsif($inum == 3)
{
@letters = (d,e,f);
return @letters;
}
}
thanx in advance
BR,
kumar
#!/usr/bin/perl
print "Enter the Integers";
my $Integers =<>;
my @numbers =split(',',$Integers);
$numofint =scalar(@numbers );
@oldarray=0;
foreach my $num (@numbers)
{
is_inum($num);
print "@letters"
}
sub is_inum
{
print "$num\n";
my ($inum)=shift(@_);
if ($inum == 2)
{
@letters = (a,b,c);
return @letters;
}
elsif($inum == 3)
{
@letters = (d,e,f);
return @letters;
}
}
thanx in advance
BR,
kumar