Perl input template - loopline gives syntax warning

This template:

read N:int
loopline N Heap:int

generates the following output (I took liberty to omit some comments):

use strict;
use warnings;
#use diagnostics;
use 5.20.1;

select(STDOUT); $| = 1; # DO NOT REMOVE

my $tokens;

chomp(my $n = <STDIN>);
chomp(my $tokens=<STDIN>);
my @inputs = split(/ /,$tokens);
for my $heap (@inputs) {

duplicate declaration of my $tokens results in syntax error.

EDIT: oops, I have actually found out that the code works. It still throws a warning message to STDERR though.