Hi I am new to perl.

I am trying to access a variable which is declared in a package. I
have kept both the files in the same directory. But still my code
errors out as ""$my_val" requires explicit package name".

my_file.pl
=======================
#!/usr/bin/perl

use strict;
use my_package;

print "\nValue : $my_val\n";


my_package.pl
======================
package my_package;

my $my_val = "Just a test";

1;



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to