muizelaar has asked for the wisdom of the Perl Monks concerning the following question:

Hi is it possible to run a two subroutines from within an existing subroutine. I have attached a small part of my script which when run will tst the existence of 3 files. if they don’t not exist i would like it to run two other routines within my script. the problem I’m having is that it test for the existence but does not seem to run the two subroutines if the files do not exist. I can provide the full script if required just thought it might be easier this way. :)
sub testlink { chdir($location) || die "Can't Chdir to $newdir: $!"; if ( -e $web_setup || $webin || $web_service ) { print "The links for the \"$site\" site may already exist please check + and try a gain.\nYou may need to remove links before adding them.\n"; } else { &linkfile; &linkdir; }

Replies are listed 'Best First'.
Re: Running multiple subroutines
by toolic (Bishop) on Sep 21, 2007 at 14:04 UTC
    I think you might really want something like:

    if ( (-e $web_setup) || (-e $webin) || (-e $web_service) ) {

    In your code, if $webin or $web_service is defined, and not equal to 0, your if is probably always resolving to TRUE, in which case your subroutines may never execute.

      Hi That worked great thanks for your help :)
Re: Running multiple subroutines
by perlfan (Parson) on Sep 21, 2007 at 14:16 UTC
    You might want to take a gander at, Running subroutines asynchronously.

    update: nevermind, I thought you wanted to spawn multiple subs at the same time on your condition...