# Find out if $userName is on the system $userList = `who | grep $userName`; if ( defined( $userList ){ print "$userName is logged in\n"; }
$userList = `who | grep $userName 2>&1`;