Re: Package require question again

2005-09-19 Thread Jeff 'japhy' Pinyan

On Sep 19, Luinrandir said:


From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]>


   my $g = $main::{$Player{Location} . "::"}{Options};
   my $value = $$g;

or, as one line:

   my $value = ${ $main::{$Player{Location} . "::"}{Options} };



is the double $$ in $$g a mistake or real?


If it was a typo, what on earth would I have written it for?  What would

  $g = ...;
  $value = $g;

do that

  $value = ...;

wouldn't do?

--
Jeff "japhy" Pinyan%  How can we ever be the sold short or
RPI Acacia Brother #734%  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %-- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Package require question again

2005-09-19 Thread Charles K. Clarkson
Luinrandir  wrote:
: 
: is the double $$ in $$g a mistake or real?

Real.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Package require question again

2005-09-19 Thread Chris Devers
On Mon, 19 Sep 2005, Luinrandir wrote:

> From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]>
> 
> >my $g = $main::{$Player{Location} . "::"}{Options};
> >my $value = $$g;
> 
> is the double $$ in $$g a mistake or real?

It's real. 

He's dereferencing that which $g refers to.

Read up on references. 


-- 
Chris Devers

{¬[³)÷|Ï/:–Ð
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: Package require question again

2005-09-19 Thread Luinrandir
- Original Message - 
From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]>
To: "Luinrandir" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, September 19, 2005 6:43 AM
Subject: Re: Package require question again
> 
>my $g = $main::{$Player{Location} . "::"}{Options};
>my $value = $$g;
> 
> or, as one line:
> 
>my $value = ${ $main::{$Player{Location} . "::"}{Options} };


is the double $$ in $$g a mistake or real?
Lou



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




Re: Package require question again

2005-09-19 Thread Jeff 'japhy' Pinyan

On Sep 17, Luinrandir said:


ok I have the program working again.
but how do I get a var from the package?

and the cgi calls the var in the package like this
my $V = $main::{$Player{Location} . "::"}{Options};


What does that return to you?  A glob.  And a glob is like a reference to 
every data type.  To get the scalar variable found in the glob, you have 
to dereference the glob as if it were a scalar:


  my $g = $main::{$Player{Location} . "::"}{Options};
  my $value = $$g;

or, as one line:

  my $value = ${ $main::{$Player{Location} . "::"}{Options} };

--
Jeff "japhy" Pinyan%  How can we ever be the sold short or
RPI Acacia Brother #734%  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %-- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Package require question again

2005-09-17 Thread Luinrandir
I want to thank everyone who has helped me with this.
and I'm trying to remember to bottom post

ok I have the program working again.
but how do I get a var from the package?


At the time you are reading this I am still experimenting wih the following:

the package has this line in it.
$Options="Buy Sell Talk Sleep Work Move";

and the cgi calls the var in the package like this
my $V = $main::{$Player{Location} . "::"}{Options};

I am also experiementing with the $glob command

Help?
Lou



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]