Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Making variable...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 10695 of 12002
Post > Topic >>

Making variables private

by paikkos@[EMAIL PROTECTED] (Dermot) Mar 6, 2008 at 03:42 PM

------=_Part_24762_22944625.1204818157478
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I have a file with a few settings in, a hash of settings.

EG:

use strict;
use warnings;
our @[EMAIL PROTECTED]
 = qw($fileSize);

our $fileSize = { a=> {name => 'small', size => 50}, b=>{name=> 'medium',
size => 75,} c=>{name=> 'large', size => 100} };

These settings are used by several different programs and I don't always
want to apply all the settings. I thought I could do this:

# Make a local copy of HoH
my $ref = $fileSizes;

# remove a hash via key c
delete $ref->{'c'};

Print the original structure
print Dumper($fileSizes);

When I do this I get the reference without the C hash! I'm sure this is by
design, I'm sure there is a good reason for it but how keep a version
private?

Hope

------=_Part_24762_22944625.1204818157478--
 




 5 Posts in Topic:
Making variables private
paikkos@[EMAIL PROTECTED]  2008-03-06 15:42:37 
Re: Making variables private
noreply@[EMAIL PROTECTED]  2008-03-06 17:03:46 
Re: Making variables private
chas.owens@[EMAIL PROTECT  2008-03-06 11:02:21 
Re: Making variables private
yitzle@[EMAIL PROTECTED]   2008-03-06 11:10:52 
Re: Making variables private
daggerquill@[EMAIL PROTEC  2008-03-06 11:13:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 14:55:57 CDT 2008.