in reply to My my

Saxium:

You're creating *two* variables named $x. (That's what the "...masks earlier declaration..." message that monkey boy pointed out means.) The printme subroutine uses the second one, as it's the one in scope at the point where it's compiled. At the first call, the second $x variable has nothing in it, so you don't get a value in the print statement. *Then* you're assigning 'b' to it, calling printme, at which point it prints "b".

If you simply remove the 'my' from the second assignment to $x, you'll have a single $x variable, and the program will do what you're expecting.

Update: Added the sentence in parenthesis.

...roboticus

When your only tool is a hammer, all problems look like your thumb.