Jan Eden wrote:

>Hi all,
>
>I finally decided to use the taint mode in all my CGI scripts. But I
>experience a strange problem. The following two lines read a file
>depending on the parameter 'jahr':
>
>my ($jahr) = $q->param('jahr'); my %monate = %{do $jahr} or die $!;
>
>This worked. Now, with the -T switch, I have to untaint $jahr, which
>always consists of 4 digits:
>
>my ($jahr) = $q->param('jahr') =~ /\d{4}/; my %monate = %{do $jahr}
>or die $!;
>
>The second line now gives me the error:
>
>Can't use an undefined value as a HASH reference at
>../cgi-bin/belegung.pl line 20.
>
>Ok, so I checked if $jahr really has a value. It does. I went on
>adding the following check
>
>if (defined $jahr) { my %monate = %{do $jahr} or die $!; }
>
>Still the error message. Now I tried this:
>
>if (defined (do $jahr)) { my %monate = %{do $jahr} or die $!; }
>
>Error message is gone. Mysteriously, the feature of being defined
>gets lost in the transition from $jahr to "do $jahr". I cannot
>understand this, since it worked before, and the content of $jahr
>has not changed. It still contains a string of 4 digits.

Ha! Fixed it myself: I forgot that "./" is not in my path.

Thanks,

Jan
-- 
Common sense is what tells you that the world is flat.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to