in reply to My my
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:
which duly prints:#!/usr/bin/perl use strict; use warnings; my $x = 'a'; printme($x); $x = 'b'; printme ($x); sub printme { print "x: ", shift, "\n"; }
x: a x: b
|
|---|