in reply to My my

Yeah, there is really no reason to use a prototype (the empty parentheses in the subroutine definition) here.

And also it would be better to pass your variable as an argument to the subroutine, rather than using is as a global variable, for example with something like this:

#!/usr/bin/perl use strict; use warnings; my $x = 'a'; printme($x); $x = 'b'; printme ($x); sub printme { print "x: ", shift, "\n"; }
which duly prints:
x: a x: b

Je suis Charlie.