sub cls - ternary operator, magical lexicals

 
 
 
sub cls returns Void {
    system(($?OS eq any<MSWin32 mingw cygwin>) ?? 'cls' :: 'clear');
}

    
  • Returns nothing.
  • Checks the magical lexical (S02) $?OS against a junction consisting of 3 values.
  • The angle bracket syntax is a shorthand for qw(space sep wds) in Perl 5 and q:w/space sep words/ in Perl 6. See S02 for more details
  • The ternary operator ?? :: decides what system command to use to clear the screen.