Were I your professor, I'd mark that quip down, since it's attached to a method of declaring variables that's legal, but falls far short of 'best practice.'
Perl is not one of your "previous programming languages" and your response to your own rhetorical question about "the better way of declaring variables" isn't quite 'on-target' here. Perl (well, thru 5.10, IIRC) will accept the way you've done it, without even suggesting that there's a better way... which involves understanding scope... and the best practice of limiting a variable's scope as narrowly as possible.