On 6/29/07, raiph <[EMAIL PROTECTED]> wrote:
snip
Finally, but very importantly imo, what if there are 3 or more
alternatives?
snip
Use a hash or array (depending on the selecting data).
system((zip <win32 linux other>, <cls clear nuke>)<$?OS>);
system({win32=>'cls', linux=>'clear', other=>'nuke'}<$?OS>);
Of course, this should actually be abstracted more. What happens if
there is a fourth platform?
my %command = (
win32 => {
clear => 'cls',
ls => 'dir /b',
dir => 'dir',
},
linux => {
clear => 'clear',
ls => 'ls',
dir => 'ls -l',
}
);
...
system %command{$?OS}<clear>;