[PLUG] Perl: Array of structs?
Matt Alexander
m at pdxlug.org
Tue Jun 24 12:19:02 UTC 2003
I'm trying to create an array of structs. Each different struct
represents a different page. I'd like to assign values and print them
out, but the slightly modified example below from the Perl Cookbook
doesn't work. Any help would be greatly appreciated.
Thanks,
~M
use Class::Struct;
struct Page => {
pagenumber => '$',
linenumber => '$',
column => '$',
dataline => '$',
name => '$',
address => '$',
phone => '$',
subcat => '$'
};
my @page = Page->new();
$page[1]->pagenumber("1");
$page[1]->linenumber("1");
$page[1]->column("2");
$page[1]->dataline("blah blah blah some name here 123 4567 blah blah");
$page[1]->name("John Smith");
$page[1]->address("123 SW 123 St.");
$page[1]->phone("123 4567");
$page[1]->subcat("1");
print "STRUCT PHONE TEST: $page[1]->phone";
More information about the PLUG
mailing list