> #this does NOT work > #how do i reference these vars > USER::fname="bob"; > USER::lname="Bingham";
You need the $, like this... $USER::fname="bob"; $USER::lname="Bingham"; But this may be what you really want. It will allow you to create multiple USER objects, each with different values stored in them. use USER; my $user = new USER(); $user->{fname} = "bob"; $user->{lname} = "Bingham"; print $user->prt() . "\n"; USER.pm ------- package USER; sub new { my $class = shift; bless {}, $class; } sub prtAll { my $self = shift; # $self is the object ... } -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 7:01 PM To: [EMAIL PROTECTED] Subject: Look At This Package Can someone make this work like I want? I'm trying to create a package USER and reference/change it. The only thing I'm able to do is to call the sub prtAll. I just want a structure that I can pass around in perl. test.pl ------- use USER; #this does NOT work #how do i reference these vars USER::fname="bob"; USER::lname="Bingham"; print USER::prt . "\n"; USER.pm ------- package USER; $fname; $lname; sub prtAll { ... } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]