From: "newbie01 perl" <newbie01.p...@gmail.com>
Hi all,

Am wanting to change my Perl scripts to get it to run on several UNIX
flavours and Windows. At the moment, the only way I can think of how to
accomplish that is always having the following checks on each and every sub
that I have.

Can anyone please suggest if there is a better way of doing this besides
what am doing now? Am not sure whether creating a module for each OS to use is the solution although I don't know how to create a module anyway. I found one tutorial and get lost somewhere along the way on how to create a module
... :-)


if ($^O eq 'MSWin32') {
   system "dir $ARGV[0]";
}
...

Whenever it is possible it is recommended to use core functions or Perl modules instead of external programs and commands.

If you want to read the list of files from a directory you can use opendir(), readdir(), closedir() or glob().

Read the POD documentation for those functions using:

perldoc -f opendir
perldoc -f glob
...

Octavian



__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 5040 (20100419) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to