OK:
my $login='anybody';
exit if $login ne 'root';
NOT OK: Why doesn’t the following print “error“?
my $login='anybody';
(print "error" && exit) if $login ne 'root';
I know about if (condition) {action}. I just want to know about current problem.
Because what you have written says:
“print the evaluation of the string ‘error’ and the result of the command exit”
You could actually write:
But please don’t. 🙂