in reply to Passing a variable to a sub process.

Inside sub mkdirs, you are declaring a new vaiable, $nossl, which is local to the sub. It is different from the variable of the same name which resides in the calling scope.

Perhaps what you want to do is:

#!/usr/bin/env perl use warnings; use strict; my $nossl = 'foo'; mkdirs($nossl); sub mkdirs { my $nossl = shift; print "nossl=$nossl\n"; }

This prints:

nossl=foo

Take a look at shift, perlsub and my.

Replies are listed 'Best First'.
Re^2: Passing a variable to a sub process.
by misconfiguration (Sexton) on Apr 02, 2008 at 18:21 UTC
    I hope to someday be as wise as you two, the depth of understanding you have is quite amazing.

    After the string $nossl was passed into the subroutine I changed some things.
    my $nossl = shift; my $newsite = $nossl;


    Thanks again for your help, I learned a lot from this lesson.
      Since you never use $nossl within your routine, this is equivalent to
      my $newsite = shift;
      There is no significance in using the same name inside and outside the routine. This just says that you want to set $newsite using the first parameter passed to the subroutine.