1 |
Terje Kvernes wrote: |
2 |
|
3 |
>"Chad M. Huneycutt" <chad.huneycutt@×××.org> writes: |
4 |
> |
5 |
>>Can anyone explain to me why this I can't see $dir inside the unless |
6 |
>>block in the code fragment below? |
7 |
>> |
8 |
>>sub recurse { |
9 |
>> my $dir = shift; |
10 |
>> |
11 |
>> print "dir: $dir\n"; |
12 |
>> unless ( defined($exceptions{$dir}) ) { |
13 |
>> print "$dir is not an exception |
14 |
>> } |
15 |
>>} |
16 |
>> |
17 |
> |
18 |
> I expect you've left out a " on the second print statement? :) |
19 |
> |
20 |
|
21 |
Yeah, this was a typo in the e-mail only. |
22 |
|
23 |
> |
24 |
> |
25 |
> |
26 |
>>basically, dir is correct in the first print statement, and then |
27 |
>>gone inside the unless block (even if I do a "unless (0)", the |
28 |
>>second print shows $dir as undefined). |
29 |
>> |
30 |
> |
31 |
> it shouldn't. unless you've tied %exception into something that |
32 |
> resets the keys on read. |
33 |
> |
34 |
I don't know why I was seeing this behavior, but I downloaded the |
35 |
program again, and the problem I was seeing here went away. |
36 |
|
37 |
The actual problem was that the @#$@#%@# configuration file for my |
38 |
program (the file where $dir gets its value) was in MS-DOS format |
39 |
(newline and carriage return), which was causing some very strange |
40 |
behavior. Kudos to kabau for helping me diagnose it! |
41 |
|
42 |
Chad |