When you run the code you wrote through the debugger you will notice that it executes the our ... statement after the subroutine has run. Some simple repositioning of code as this,

#!perl package My::Test; our $VERSION = 1.11; package My::Test::Print; our $VERSION = 1.2; sub printer { print "This is ". $My::Test::VERSION ."\n"; } package main; my $test = 1.23; print "test: $test \n"; print My::Test::Print::printer() ."\n"; 1;

Makes this output:

test: 1.23 This is 1.11

Note that I took the liberty of adding a VERSION in each different package which I think is what you meant to do.

Celebrate Intellectual Diversity


In reply to Re: float: Perl is replacing dot with comma (automagic locale?) by InfiniteSilence
in thread float: Perl is replacing dot with comma (automagic locale?) by isync

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.