<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div><span style="font-family: arial,helvetica,sans-serif;">Hi Everyone,</span><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">A piece of my code is behaving in a way I didn't expect and I was hoping someone could enlighten me as to why..</span><br style="font-family: arial,helvetica,sans-serif;"><br>-------------------------------------<br><font size="2">$ cat a.pl <br>push @INC, '.';<br><br>our $c = 15;<br><br>require newbie;<br></font>-------------------------------------<br><font size="2">$ cat newbie.pm <br>package newbie;<br><br>print "first attempt: " . $c . "\n";<br>print "second attempt: " . $::c . "\n";<br><br>1;<br></font>-------------------------------------<br><font
 size="2">$ perl a.pl <br>first attempt: <br>second attempt: 15</font><br>-------------------------------------<br><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">The way I see it the <span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">our</span> in <span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">a.pl</span> should make it global across all namespaces. The second attempt does seem to say that did take place. What I am not sure is why the <span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">$c</span> variable has become local in scope even though I haven't re-declared or redefined it in any way inside <span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">newbie.pm</span>.</span><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"><br
 style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">- Mithun</span><br></div>
</div><br>

      </body></html>