in reply to variable initilization
Things go wrong from the very first program statement.
cwd is a "buzz word" meaning: current working directory.
Without getting into fancy stuff, I show below why the first statement is wrong ('cwd' is almost certainly not what is intended for $Kitdir). And then I say that there is no need to translate "forward slash" to "back slash". Perl will do that for you when it is necessary as a path name! I show you that this translation works, but don't do it!
So that covers your first 2 program statements.$KitDir = cwd; print "$KitDir\n"; # prints 'cwd' use Cwd; $Kdir = getcwd(); # $Kdir is: Where am I? print "$Kdir\n"; # prints 'C:/TEMP' $Kdir =~ s|/|\\|g; # not necessary! Don't! print "$Kdir\n"; # prints 'C:\TEMP'
In the below:$ENV{'KITDIR'} = $KitDir; #assigns $KitDir value to #KITDIR key in ENV hash
I suppose we could have:$KitDir = $ENV{'KITDIR'}; if ($KitDir eq "") { $KitDir = $Config::Conn{KitDir}; }
but it is hard for me to see how $ENV{'KITDIR'} could be false given the above statements.$ENV{'KITDIR'} ||= $Config::Conn($KitDir);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: variable initilization
by mtrasp (Acolyte) on Nov 25, 2009 at 21:24 UTC | |
by Marshall (Canon) on Nov 26, 2009 at 03:58 UTC |