Luinrandir wrote:
OK.. maybe I'm trying to be too fancy.


use tsruic
the package is:
###################
package Names;
@Countries("Ireland","Wales");

Don;t double quote string that have nothing being interpolated, use single quotes or q()

%Lord{Ireland}=("Bob","Tom");

$Lord{Ireland} not %Lord{...

%Lord{Wales}=("Ted","Ned");

Don't assign an array to a scalar, you'll get the number of items in the list not the list, use refernces.

Don't store your data in 2 places (IE an array *and* they keys of a Hash), then you have to maintain it:

package Names;

use strict;
use warnings;

our %Lord = (
  Ireland => ['Bob','Tom'],
  Wales => ['Ted','Ned']
);

1;

#!/usr/bin/perl

use strict;
use warnings;
use Names;

for my $country (keys %Names::Lord) {
   for(@{ $Names::Lord{$country} }){
      print "$country: $_\n";
   }
}

return 1;
#################
the program is:
###################
foreach $Country(@Names::Countries)
{
    print qq|$Names::$Lord{$Country}|;

$Names::Lord

use strict;
use warnings;

Alway always always do those 1st thing.

They would have told you the problem with your code right off.

}

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


Reply via email to