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