Me again

if you only want to print what's in your hash, you can do

my %hash = qw(sky blue grass green apple red);
foreach (%hash){ print "$_ = $hash{$_}"; }

But since your hash doesn't have a key->valyue pattern, I don't know why
it's not stored in a simple array..

my @array = qw(sky blue grass green apple red);
foreach (@array){ print "$_ "; }

Etienne

Neclos wrote:

> I need to create a hash with fixed elements and print all elements.  I
> keep getting  errors when I try to run what I put together.  I commented
> out the different ways I tried to run the print.  Now I have no clue
> what to try next.
>
> use strict ;
>
> %hash = ("sky", "blue", "grass", "green", "apple", "red") ;
> @hash_list = %hash ;
> my $k ;
> my $hash ;
> my %hash ;
>
> # my $temp = %hash;
>
> #    print "$temp";
>
> # print "@{[ %hash ]}\n";
>
> foreach $k (sort keys %hash) {
>     print "$k => $hash{$k}\n";
> }
>
> exit 0 ;
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

S/MIME Cryptographic Signature

Reply via email to