in reply to odd things with my and our

Well, here is my slightly altered version, I just put your library.pm in the same directory as the script BUT note I added the package name:
#!/usr/bin/perl -w use strict; use library; print "Library-my: ", $library::my, "\n"; print "Library-our: ", $library::our, "\n"; my $thing = $library::my; my $other = $library::our; print "Thing: $thing\nOther: $other";
and the package:
package library; my $my = "my"; our $our = "our"; print "lib $my\n$our endlib \n\n";
now the result is:
Use of uninitialized value in print at testing.pl line 5. lib my our endlib Library-my: Library-our: our Thing: Other: our Use of uninitialized value in concatenation (.) or string at testing.pl line 11.
Which is exactly as I would expect. The our declaration is added to the symbol table, but the my is lexically scoped within the package and thus invisible outside it. As for our being deprecated, well, perldoc for 5.8.0 does not say so. Using our effectively globalises the variable, which is generally considered poor coding style, at least the way I was taught!

Wouldn't it be cleaner to be able to get the value programatically without the effects, possibly quite dangerous, of a global? This works and allows you to get the varaibles from within the package without the global.

#!/usr/bin/perl -w use strict; use library; my ($lib_my, $lib_our) = library->retvals; print "Returned my : $lib_my and returned our : $lib_our\n"; #------------------------- #library.pm package library; my $my = "my"; our $our = "our"; sub retvals { $self = shift; return $my, $our; }
jdtoronto