I have created a package to export an array. I use the array in another package in a hash reference. In a test script, I use the Data::Dumper module, but the exported array doesn't want to print. How do I go about this?
Here is the code in the package:
package My_Stuff; use strict; use Data::Dumper; require Exporter; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @EXPORT = qw (@ary); my @ary = ( rec_length => 'A4', fname => 'A20', lname => 'A20', ); 1;
Here is the second package
package Record_Stuff; use strict; use Data::Dumper; use My_Stuff; my $rec_struct = [ @ary, title => 'A4', initials => 'A3', street => 'A40', ]; sub get_record_structure { return $rec_struct; } 1;
Here is the script to test it
use strict; use Data::Dumper; use Record_Stuff; print Dumper Record_Stuff::get_record_structure();
This is what I get printed out
$VAR1 = [ title, 'A4', initials, 'A3', street, 'A40', ];
In reply to Using exported symbols by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |