On Dec 19, 2007 2:29 AM, Ravindra Ugaji <[EMAIL PROTECTED]> wrote: > Hi Monks, > I am trying the following code to change the directory > > chdir ( '/opt/application') || die ("Can't change directory: $!\n"); > tried this also > chdir "/opt/application" || die "Can't change directory: $!\n"; snip
In addition to what others have already said, never do the second*. The || operator has a higher precedence than function calls, so func "string" || die "oops"; is really saying func("string" || die("oops")); Since "string" is truthy, the die will never occur. If you want to avoid the use of parenthesis you can use the lower precedence or: func "string" or die "oops"; * unless, of course, it is what you really mean -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/