No. That's not how fork works.

use vars; creates a global variable and its value gets copied into every child spawned by fork. Usually, mixing fork and DBI is a bad idea unless you read the DBI documentation closely. I recommend you do that.

Using global variables always creates the possibility of action at a (long) distance, so restricting the scope of variables is a good approach to reducing the distance over which action can influence the values. our won't help much because it still creates global variables that can be changed from elsewhere. If you want more protection, consider using lexical variables, as declared with my.

If you want more concrete help, post concrete code that exhibits your problem. It should not be longer than 20 lines and not require outside data files.


In reply to Re: to "use vars" or not to by Corion
in thread to "use vars" or not to by westy032001

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.