Will you be using $points later? If so, this is likely to be the error. It seems like you're not running under
use strict so the fact that you expect
$points to be an arrayref but actually you're writing into
@points isn't caught. There is another error in the assignment, as each
$points[$posi] element will have
($prev[0],$prev1) evaluated in scalar context, yielding the second element only. I'd try:
for $posi (1 .. 4) {
@prev = ($prev[0] + cos($rot+$ang[$posi]) * $dist[$posi],
$prev[1] + sin($rot+$ang[$posi]) * $dist[$posi]);
$points->[$posi] = [ @prev ];
glVertex2f(@prev);
}
Edit: copied the same mistake I explained just before m(