catfish1116 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to create a hash and then print it out. When executing program, I am getting $key & $value need explicit package. O wise monks, please show me the error of my ways :)
#! /usr/bin/perl use v5.12; use warnings; ## 2/15/19 my @people = qw{ fred barney fred wlima dino barney fred pebbles +}; my %count; # new empty hash $count{$_}++ foreach @people; while ( ($key, $value) = each %count) { print "$key => $value\n"; } ~
TIA the catfish
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Print out hash
by marto (Cardinal) on Feb 15, 2019 at 16:16 UTC | |
Re: Print out hash
by pryrt (Abbot) on Feb 15, 2019 at 16:15 UTC |