This is my sub;
Code:
sub projName
{
print "Enter project name: " ;
$PROJ = <STDIN>;
print "";
if (-d "${PROJ}")
{
print "Good project\n";
}
else
{
print "Not a valid project name. Try again\n" ;
projName;
}
}
I can call this routine and it works fine when I enter a valid name for $PROJ. If I enter an invalid name it goes to the else block and prints the statement. However, it does not call itself. Instead the script just exits.
I've googled 'perl recursive subroutines' and the example don't appear to be doing anything different.
Any ideas what I'm doing wrong?