# New Ticket Created by S. Schulze
# Please include the string: [perl #83280]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=83280 >
When using a hyper += to fill in values in an array, you get different
behaviours depending on whether the array has been initialised or not.
Some example code:
my @h = (-8,-9);
my @f = (-3,-6,-1);
my @g = (24, 75, 62, 9);
convolve(@f, @h);
sub convolve (@f, @h) {
my (@k, @l, @m); # set up three arrays
@k = 0 xx + @f + @h - 1; # initialise @k to zeros
@k[^@f X+ ^@h] >>+=<< (@f X* @h); # convolve into initialised array
@l[^@f X+ ^@h] >>+=<< (@f X* @h); # convolve into uninitialised array.
@m[^@f X+ ^@h] >>=<< (@f X* @h); # hyper = for comparison
say ~@g; # correct answer (given)
say ~@k; # correct answer (calculated)
say ~@l; # wtf?? why is initialisation significant?
say ~@m; # expected wrong (>>=<<)
}
Output:
24 75 62 9
24 75 62 9
24 48 8 9
24 48 8 9