dichtfux has asked for the wisdom of the Perl Monks concerning the following question:
##### start of app.pl ##### #!/usr/bin/perl my $settings_file = "./settings.pl"; use strict; our %default_settings; require $settings_file; # ERROR IS IN THE NEXT LINE: %settings is empty (because %default_sett +ings is empty) my %settings = %default_settings; ##### end of app.pl #####
##### start of settings.pl ##### %default_settings = ( $verbose => 1, $debug => 0, $help => 0, $game => "etqw" ); ##### end of settings.pl #####
##### start example ##### spirit@threat:~/develop/example$ cat hello.cpp #include <stdio.h> #include <stdlib.h> #include "var.cpp" int main(int argc, char *argv[]) { printf("Hello world!\n"); printf("I'm %i years old!\n", var); return 1; } spirit@threat:~/develop/example$ cat var.cpp int var = 3; spirit@threat:~/develop/example$ g++ hello.cpp spirit@threat:~/develop/example$ ./a.out Hello world! I'm 3 years old! ##### end example #####
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sharing a variable between (>=) 2 files
by Joost (Canon) on Nov 30, 2007 at 22:38 UTC | |
by dichtfux (Sexton) on Nov 30, 2007 at 22:56 UTC | |
by Joost (Canon) on Nov 30, 2007 at 23:08 UTC | |
by dichtfux (Sexton) on Dec 01, 2007 at 14:51 UTC | |
by Argel (Prior) on Dec 01, 2007 at 00:10 UTC | |
|
Re: Sharing a variable between (>=) 2 files
by moritz (Cardinal) on Nov 30, 2007 at 22:32 UTC | |
by dichtfux (Sexton) on Nov 30, 2007 at 22:51 UTC | |
|
Re: Sharing a variable between (>=) 2 files
by LighthouseJ (Sexton) on Dec 03, 2007 at 21:20 UTC | |
|
Re: Sharing a variable between (>=) 2 files
by agent_smith (Scribe) on Dec 06, 2007 at 14:03 UTC |