Monks, I've dealt with this before with no issues; I've tried a lot of different scenarios so I could try to get this particular issue resolved.

I am trying to pass $nossl to a subprocess in order for it to be handled. For some reason the variable ends up empty once I try to declare it inside of the subprocess.

if ($nossl) { &mkdirs($nossl); }

sub mkdirs { # Can be used to build SSL and non-SSL sites. my $nossl; my $newsite = $nossl; if ( -e "/virtual/$newsite" ) { die "The site \"$newsite\" must already be built!\n"; } else { my %mkdircmd = ( virtual => "mkdir /virtual/$newsite", apachedir => "mkdir /etc/httpd/conf/$newsite", ssl_crt => "mkdir /etc/httpd/conf/$newsite/ssl.crt", ssl_csr => "mkdir /etc/httpd/conf/$newsite/ssl.csr", ssl_key => "mkdir /etc/httpd/conf/$newsite/ssl.crt", logs => "mkdir /var/log/httpd/$newsite" ); system( $mkdircmd {'virtual'} ); system( $mkdircmd {'apachedir'} ); system( $mkdircmd {'ssl_crt'} ); system( $mkdircmd {'ssl_csr'} ); system( $mkdircmd {'ssl_key'} ); system( $mkdircmd {'logs'} ); sleep 2; print "Directories have been built!\n"; } }

In reply to Passing a variable to a sub process. by misconfiguration

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.