OS is found via the $^O ("carrot capital O") special var:
$ perl -e 'print $^O'
linux
I think winx stuff starts w/ "MS"
C:\>perl -e "print $^O"
MSWin32
but you don't really want to do that. File::Copy
$ perldoc File::Copy
use File::Copy;
copy("file1","file2") or die "Copy failed: $!";
copy("Copy.pm",\*STDOUT);
move("/dev1/fileA","/dev2/fileB");
does it OS-independently. Using the perl native opendir/readdir commands
perldoc -f readdir
...
opendir(DIR, $some_dir) ΓΆΓΆ die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" }
readdir(DIR);
closedir DIR;
again does this w/o needing to know which OS you're on. You may also want
to look at:
NAME
File::Spec - portably perform operations on file names
as for the 2nd question/shebang lines - yeah MS doesn't use the shebang,
it uses file extension. However perl does use the shebang, even on winx so
you can just have a shebang of
#!perl -w
and get the warnings etc enabled. We used to just make a matching batch
file that called perl on the script.
a
Andy Bach
Systems Mangler
Internet: [EMAIL PROTECTED]
VOICE: (608) 261-5738 FAX 264-5932
"The Microsoft Exchange Information Store service depends on
the Microsoft Exchange Directory service which failed to
start because of the following error:
The operation completed successfully."
(actual MSE error msg)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs