On 03/09/2017 03:58 AM, Timo Paulssen wrote:
"my" variables are lexically scoped to the curly braces that contain
them. That means that your $IAm is limited exactly to that init block.
Also, =~ isn't in perl6.

You can put "my $IAm" outside that block and assign to it inside the
block, though.

HTH
  - Timo


Hi Timo,

I did have to fix the syntax.  It now looks like:

sub IAm () {
   my $IAm = $?FILE;
   $IAm ~~ s|.*"/"||;
   return $IAm };

I had originally swiped it from some of my code in
Perl 5


But ... back to the original question, I am finding no
way to initialize variables inside a pm module globally
such that I don't have to constantly call the above
sub over and over.

Is there a way to set variables globally in pm
modules or do I have to constantly create them
inside my "is export" subs?

Thank you for the help!

Many thanks,
-T


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to