in reply to Does a foreach create a scalar reference?

From Perlsyn

In other words, the foreach loop index variable is an implicit alias for each item in the list that you're looping over.

In other words: Yes. It creates a reference.

On a side note: I'm glad to see use strict; and use warnings, but you don't need #!/usr/bin/perl -w as well: The -w is basically a slightly dumbed-down version of use warnings, and is redundant in this code. (And unless you understand why I said 'in this code', is likely to cause you headaches someplace down the line if you keep using it.)