I think try doing %elementList instead of @elementListin your .pm file.Then
use 



   while ( my ($key, $value) = each(%$hash) ) 
        {
            print "$key => $value\n";
        }

In your main.pl

-----Original Message-----
From: Noah [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 08, 2008 5:00 PM
To: Manasi Bopardikar
Cc: beginners@perl.org
Subject: Re: use variables from another file



okay something still is not working for me.  What am I doing wrong?

main.pl


--- snip ----


#!/usr/bin/perl
#
use Expect;
use strict;
use elements;
#
#

for my $element (@elementList) {





from elements.pm


---- snip ----




#
package elements;


my @elementList = (
                 {
                     x => 'blah',
                     y => 'blah2',
                     reserved => 'blah3',
                     z => 'globs',
                     aa => 'wish',
                     bb => 'w',
                 },
);

--- snip ---


  ./main.pl
Global symbol "@elementList" requires explicit package name at ./main.pl





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



DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

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


Reply via email to