From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Greg
        Sent: 27 July 2005 16:11
        To: [email protected]
        Subject: Variable reference
        
        
        ---INTERNET EMAIL NOTIFICATION---
        This email originates from the Internet and therefore may not be
from the apparent sender. Please check any attachments carefully before
opening them as they may not be as they appear. 
        If you have any doubts about the origin or content of the email
please contact PC Support on x2288.
        ---
        
        Sorry if this has been answered before but I am in a quandary.  
        
        I am trying to get the contents of a variable when that
variables name
        is itself in a different variable. For example:
        
            $database_name = "Greg";
            $text = "database_name";
            $value = "\$" . $text;
            print $value;
        
        I need to have 'Greg' printed not $name;
        
        Is this possible? Seems I've seen this before but can't recall.
        Thanks for all your help.
        Greg
            
        
You can use symbolic references, but it is not advisable. Use a hash
instead. Its safer and you can leave strict checking on (you do have
'use strict;' and 'use warnings;' in your scripts like all good Perl
programmers?).

If you want to find out about symbolic references, they are described in
'perldoc perlref'.

HTH

-- 
Brian Raven
 





-----------------------------------------------------------------------
The information contained in this e-mail is confidential and solely 
for the intended addressee(s). Unauthorised reproduction, disclosure, 
modification, and/or distribution of this email may be unlawful. If you 
have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message 
do not necessarily reflect those of LIFFE Holdings Plc or any of its subsidiary 
companies.
-----------------------------------------------------------------------


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to