Hi Members,

It seemed that a value was incorrectly retrieved from the hash list in the
following small Perl script. .

#!/usr/local/bin/perl

sub card{

  my %card_map;
  my ($num)=@_;
 @card_map{1..9}= qw(one two three four five six seven eight nine);
  if ($card_map{$num}) {
     $card_map{$num};
  } else {
      $num;
  }
 }

while (<>) {
  chomp;
  print "card  of $_ is:" &card($_), "\n";
}


The problem is when a numeric value is inputed, it can't get correct
correspondent English name. Any help is appreciated

Reply via email to