Hi all,
What are the statements in a perl script that need attention/change for making the script run in a different OS.
ofcourse the perl interpreter path(hashbang line)
Say for eg: perl statements (system, exec and backtick ) involves command line commands.So commands will differ for different OS and so that needs to be changed.
what else needs change?
help out,
thanks.

Recommended Answers

All 4 Replies

For different versions of UNIX, usually nothing. You will have to make sure that any modules you use in your script on one system are present in the next system for them to work.

Modules will also be your biggest problem working between the Windows and UNIX platforms. Some modules are designed only for the UNIX environment. In addition to this, any system commands that you call in one will be obviously different in the other.

Beside these differences, the core language should operate identically in different environments.

some of perls native functions are also meant for Unix, such as flock() and chmod() and some functions might return a different value depending on the operating system, like stat().

What about the execution of binaries with perl script in Windows.

should be the same if you use a correct path to the binary. some functions to access the binary will be different (won't work), but calling open $out," | *.exe" or exec(*.exe) should work the same...

I don't know whether system() works, but I imagine it does..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.