http://www.perlmonks.org?node_id=570612


in reply to Executing a external command

Interestingly... on W2k with AS 5.8.6

C:\foo\>perl -e "print `dir;" Can't find string terminator "`" anywhere before EOF at -e line 1.

    ...and yes, that is a backtic before dir.
Did it need to be escaped? Or am I truly deep into Altz-a-whatchamajig?

UPDATE See reneeb's shot of brainpower, immediately below.

However ...

C:\foo\>perl -e "system dir;" <snip ...> Directory of C:\foo\ 08/31/2006 10:06a <DIR> . 08/31/2006 10:06a <DIR> .. 11/21/2003 02:49p <DIR> .c-- 11/21/2003 02:49p <DIR> .c# <snipped - no further interest here ... >

...and...

C:\foo\>perl -e "$cmd=system(dir);print $cmd;" <snip ...> Directory of C:\foo\ 08/31/2006 10:06a <DIR> . 08/31/2006 10:06a <DIR> .. 11/21/2003 02:49p <DIR> .c-- 11/21/2003 02:49p <DIR> .c# <snipped> 3 File(s) 2,731 bytes 9 Dir(s) 67,502,247,936 bytes free 0 <=== There is the UNshifted system status/return code referenced abo +ve.... C:\foo\>