----- Original Message ----- From: "Paul Kraus" <[EMAIL PROTECTED]> To: "Perl" <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 2:16 PM Subject: Constants and Hash Question
> I am declaring my constants like this. > use constant SOURCE => "/path/folder/" > Now how would I use this constant is a print statement or any statement > for that matter. > print "$SOURCE" does not work and of course print "source" will not > work. > print SOURCE; > > I understand that this works but I do not understand what its doing and > the need for the parenthesis. > Could someone explain this statement for me. I have put <> around the > part I don't understand. > > this is part of a tied hash for Config::IniFiles. > --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > while (($k,$v) = each <%{$ini{$section}}>) > %ini is a hash being referenced by scalar $section. The hash values are references to other hashes, so $ini{$section} is a hash reference. This must be enclosed in a block before it is dereferenced to a hash, as %$ini{$section} would try to dereference scalar $ini (which doesn't exist) as a hash. So we have %{ $ini{$section} }. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]