>>Jonathan A. Spinks at [EMAIL PROTECTED] wrote: >> I've written a perl script on a unix and I want to transfer it to a >> mac.. ... conversion differences between a unix box and a PC are things >>like rm >> which becomes del. Enrique Terrazas <[EMAIL PROTECTED]> wrote: >Take a look at the perl functions "unlink" and "rename" >to get rm and mv functionality. Script portability is a big thing in Perl since it's use has spread over various operating systems, and not to put too fine a point on it (and also trying to avoid sounding like a nagging mother), not bothering about portability is why you are where you are now. Enrique's suggestion will work on any OS which runs perl (avoiding having to rewrite the same script everytime you want to move it). Check out macperl.pod which covers the main differences between Unix and Mac OS's, plus features available only under MacOS. However some things you should be wary of are: back ticks- Unix system commands aren't supported under MacOS, (some commands like `pwd` for example, are emulated). line endings - make sure you convert these from Unix to Mac- most Mac ftp progs do this automatically to texts anyway, but if you start to get weird runtime errors this is the thing to check first (quoting from macperl.pod) <<"\n" on a Mac means ASCII 13, as opposed to Unix, where it means ASCII 10. If you want ASCII 10, write "\012">>. This means if you use perl's '\n' token for line endings the character used will change depending on the system you save the script with, or for that matter, anything else generated by the script (your scripts might be converted during a transfer but your data files might not). path names - mac path names are separated by colons (':') not slashes ('/'), you can get round this by using File::Basename which will parse a path according to the method adopted to separate path elements by the OS it's being run under, have a look at the pods for this module if you're interested in knowing more. HTH Robin

Reply via email to