Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^7: How to import "global" variables into sub-scripts from main script?

by choroba (Cardinal)
on Mar 22, 2021 at 10:57 UTC ( [id://11130100]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use warnings;
    ...
    our $x = 12;
    require './2.pl';
    print "Done\n";
    
  2. or download this
    #!/usr/bin/perl
    use warnings;
    ...
    our $x;
    
    print $x, "\n";
    
  3. or download this
    12
    Done
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130100]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-03-29 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found