perl: bug-compatible with DOS 1.0!

On DOS, this:

A:\> WIBBLE/BOING

is equivalent to:

A:\> WIBBLE /BOING

that is to say, even with no space in between them, it finds and executes the WIBBLE program, passing it the /BOING argument.

It's only reasonable that perl's system(SCALAR) should do the same. But it's not reasonable that system(LIST) should. And yet it does. This:

system(qw(wibble/boing foo bar))

which on sane systems executes wibble/boing with arguments foo and bar, on Win32 is equivalent to:

system('wibble', '/boing', 'foo', 'bar')

If open(), unlink() and all their friends and relations can understand wibble/boing properly, then system(LIST) should too.

1 Comment

This is probably because the DOS family of OSes (hyuk hyuk, I like calling Win32 that) do not have a concept of a command argument list. All they have is a string of the entire invocation, including literal quotes and everything, which the invoked program has to parse. Which means there is no universal mechanism to quote spaces in arguments. I assume the reason that system(LIST) “understands” this syntax is that it simply does nothing special with the first argument when time comes to mash them all together to accommodate the DOS exec convention, hence it winds up working like everywhere else.

Hysterical raisins.

Leave a comment

About David Cantrell

user-pic I'm in yur test resultz analyzn yr failz