in reply to Re: Why this simple code doesn't work?
in thread Why this simple code doesn't work?
Don't call your subroutines with a prepended "&".
Actually in this case the "&" is meaningful. There is a Perl built-in called read, so the "&" serves as disambiguation, proving that you want to call the sub, and not the built-in.
Of course, the wisdom of defining a function with the same name as a Perl built-in is debatable. Sometimes it makes sense (e.g. each in Set::Scalar is designed to be used as a method, so never looks ambiguous in code. Naming it same as the built-in serves as a hint as to its purpose.) but I'm not sure this is one of those times.