On 03/12/04 16:08, Randy W. Sims wrote:


To elaborate a bit, the reason for the failure is that while the string is interpolated, it is then also evaluated as perl code, so in


my $header = <<'end_of_header';
# File: $filename
end_of_header

my $filename = 'xyz';

print eval $header;

the last statement ends up looking something like:

print # File: xyz;


I just realized that this might be a little misleading. If you break it down to:


my $result = eval $header;
print $result;

You will get an uninitialized value error. What happens is that

eval $header

is first interpolated to

eval { # File: xyz }

which is executed as perl code. As perl code this is a comment and so produces no value, so $result ends up with no value, which is then printed in the next line, generating the uninitialized value error.

Regards,
Randy.

--
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