Most likely it didn't work from the command line for you either.
This is because notepad.exe is in the program search path ($ENV{PATH}), while excel.exe is not.
You should use fully qualified program names and the list form of system(), but you still have to find Excel for yourself:
use strict;
my $excel = 'c:/Programs/Microsoft Office/Excel/excel.exe';
my $file = "c:\\path\\to\\my test.xls";
# note that Excel might want the filename delimited
# with backslashes
system( $excel, $file ) == 0
or die "Couldn't start Excel: $^E / $! / $?";
Another possibility is to rely on Windows to do the Right Thing and just let the default Windows action on a .xls file take place:
use strict;
my $file = "c:\\path\\to\\my test.xls";
# note that cmd.exe wants the filename delimited
# with backslashes
system( 'start', $file );
And, if you need more control than that, there is always Win32::OLE, with which you can automate Excel:
use strict;
use Win32::OLE;
my $excel = Win32::OLE->new( 'Excel.Application' );
my $file = "c:\\path\\to\\my test.xls";
$excel->Open( $file );
# or so I believe. Use the Macro Recorder to find out
# what the function names are actually called
|