Re: Compile error

[email protected] (Robert Hicks)
Newsgroups perl.beginners
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.