Paul Kraus wrote:
>
> 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.
The constant pragma creates a subroutine so that:
use constant SOURCE => "/path/folder/"
Is equivalent to:
sub SOURCE () { "/path/folder/" }
So you can use a constant created this way the same as you would use a
subroutine.
print SOURCE, "file.txt\n";
print SOURCE . "file.txt\n";
print "@{[SOURCE]}file.txt\n";
> 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}}>)
The value of $ini{$section} is a reference to a hash so you have to put
%{} around it to dereference the hash.
perldoc perlreftut
perldoc perlref
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]