hi there

im trying to call a subroutine and get it to return some hash table values. however, i 
have two problems.

1.  it does not work. theres something wrong with my foreach sentence,
    but i cant see what it is. however, the commented foreach sentence
    do work?

2.  the @return_array needs to be split so i get the values on
    seperate lines. how can that be done?


i take this is a very general problem and there is probably many
solution strategies. any suggestion on how to solve my current problem
and any ideas as how to improve the "return values from hash" issue will be greatly 
appreciated.

best regards

martin



#!/usr/bin/perl -w

&subroutine;

print "\n", @return_array, "\n";

sub subroutine {
    %hash_table = (
    'en'   => '1',
    'to'   => '2',
    'tre'  => '3',
    'fire' => '4',
    'fem'  => '5',
    'seks' => '6',
    'syv'  => '7',
    'otte' => '8',
    'ni'   => '9',
    'ti'   => '10'
  );

  $extract = qw (en tre ni);

#  foreach $number (qw <en tre ni>) {
  foreach $number ($extract) {
     push (@return_array, $hash_table{$number});
  }
  return @return_array;
}



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to