in reply to global module variable are imported copies?

The issue here is that you are expecting persistence, whereas normally your environment gets reset for each execution of perl. If you want your variable value to persist beyond a single run, you'll need to store the value in a place that persists beyond a single execution of the script; this spec is usually hit using files for storage. So maybe you'd want something like:
#!/usr/bin/perl package subs::utils; use strict; use warnings; BEGIN { require Exporter; # set the version for version checking our $VERSION = 1.00; # Inherit from Exporter to export functions and variables our @ISA = qw(Exporter); # Functions and variables which are exported by default # exported only if fully qualified our @EXPORT_OK = qw($henky); } my $filename = 'store.txt'; our $henky; if (open my $fh, '<', $filename) { local $/; $henky = <$fh>; } else { $henky = "henky_init"; } END { open my $fh, '>', $filename or die "Storage failed: $!" print $fh $henky; } 1; # return a true value, standard module behaviour

Note that this may cause some weird behavior if you don't expect a truly persistent type of behavior. Also note that my file name is unqualified, and is thus sensitive to your choice of working directory. If this is a problem, you'll need to give it a full path that everyone who might use the module has read permission on.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.