in reply to Re: global variables
in thread global variables

So the code can just be:
use 'inc.conf';
?? Or do i need to include a use lib, because the above isnt working for me.
I get the error:
syntax error at global_vars.pl line 5, near "use 'inc.conf'"

Cheers,
Reagen

Replies are listed 'Best First'.
Re: Re: Re: global variables
by Happy-the-monk (Canon) on May 31, 2004 at 14:48 UTC

    no, it will work allright if you just change the   my $var = "blah";   to   our $var = "blah";   in   inc.conf.

    Cheers, Sören

      so like this??
      #!/usr/bin/perl use strict; use warnings; use "inc.conf"; our $var; print $var , "\n"; exit;
      And the contents of inc.conf...
      #!/usr/bin/perl use strict; use warnings; our $var = "blah"; 1;
      Because I still get a syntax error. Forgive me if I am a bit dense :)
        no, as davidj said, ignore his post. change 'my' to 'our' and you're done. require is just fine.
        for more info read Fletch's post and see perlfunc for require and use.

        -   use "inc.conf";
        +   require "inc.conf";

        Your first try wasn't that bad.