Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I may have found a bug in perl 5.6.1 where perl does stringification differently based on scoping. (I'm compiling 5.8.0 now to see if it's already been fixed). I was wondering if Perl has an online database of bug reports so I can see if this has been already found.

For the curious, try this:

#!/usr/bin/perl -w $a = "name"; $b = 5; my $c = "name"; my $d = 5; print ".D(${a}[$b])\n"; print ".D(${c}[$d])\n";
The output that I get is:

.D(name[5]) .D([5])

Replies are listed 'Best First'.
Re: Searching for online perl bug reports
by hv (Prior) on Mar 04, 2003 at 01:36 UTC

    You can search for information on perl5 bugs at http://rt.perl.org. Note that bugs for some other projects are there as well.

    For this particular problem, it isn't actually a bug: the ${a} syntax specifically ignores lexical variables, and looks only for dynamic variables of that name. If you want to avoid the following [$d] from being treated as an array reference, you can escape the bracket:

    print ".D($c\[$d])\n";
    or split the string in two:
    print ".D($c" . "$d])\n";
    or use printf:
    printf ".D(%s[%s])\n", $c, $d;
    whichever you find most appropriate for the need.

    Hugo