Use:
instead.unless (system "ls -l /bin/bash >> $logfile 2>&1") { print "Nope!\n"; }
Further points: 1) there's no need to first create $logfile. The redirection will create it if necessary. 2) system returns 0 on success, following the Unix convention.
In reply to Re: system command has problem with '>>'
by JavaFan
in thread system command has problem with '>>'
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |