# Style 1: "The Beginner" ########################################## # Returns the pathname separator character # which depends on the type of OS. # # Usage: STRING = GetPathnameSeparator() # sub GetPathnameSeparator { my $S = uc($^O); return ':' if (index($S, 'MACOS') >= 0); return '\\' if (index($S, 'WIN') >= 0); return '/'; # LINUX OR OTHER } # Style 2: "Neat" ########################################## # Returns the pathname separator character # which depends on the type of OS. # # Usage: STRING = GetPathnameSeparator() # sub GetPathnameSeparator { my $S = uc( $^O ); if (index($S, 'MACOS') >= 0) { return ':'; } if (index($S, 'WIN') >= 0) { return '\\'; } return '/'; # LINUX OR OTHER } # Style 3: "The one-liner" $SEPARATOR = index(uc($^O),'MAC')>=0?':':index(uc($^O),'WIN')>=0?'\\':'/'; # Style 3: "somewhat condensed" # Returns the pathname separator character which depends on the type of OS. sub GetPathnameSeparator { my$Y=uc($^O); index($Y,'MAC')<0||return':'; index($Y,'WIN')<0||return'\\'; return'/'; # DEFAULT=LINUX } # Style 4: "black-hole density" sub GetPathnameSeparator{my$Y=uc($^O);return index($Y,'MAC')>=0?':':index($Y,'WIN')>=0?'\\':'/';} # Style 5: "somewhat misleading/obfuscated" sub iii{$a=uc($^O);return(index($a,'MAC')>=0?':':index($a,'WIN')>=0?'\\':'/');}