Rodrigo Tavares wrote:
Hello,

I create a hash, and i want take the keys.
Using Deitel Book, i take this example:

numbers = ( 1 => 'one', 3 => 'two', 5 => 'three', 7 => 'four', 9 => 'five', );
 @hashkey = keys (%numbers);

When I try to run come this message.
Undefined subroutine &main::chaves called at line

What's wrong ?


Would "chaves" mean "keys"?

my @haskeys = keys %numbers;

I think the parens were telling Perl to look for a sub named "keys". I could be wrong...and frequently am.

my %numbers =
         (
           1  => 'one',
           3  => 'two',
           5  => 'three',
           7  => 'four',
           9  => 'five',
         );
my @hashkey = keys %numbers;

Robert

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to