Hi all, I currently have a MS-DOS batch file that am trying to convert to a Perl script. I have something like this in the .BAT file where variables are "set" based on some parsing of a variable passed as a command line argument whenever the .BAT file is executed by the application.
The command line variable is parsed/cut-down-into pieces of source_drive, source_root, source_file, source_extn and source_path as the contents of the .BAT file shows below: ======================================================================== rem creates a ftp command file on the root directory of the drive. set ftp_action=%~dp0%~n1.ftp rem these aren't used here for debuging purposes set source_drive=%~dp0 set source_root=%~dp1 set source_file=%~n1 set source_extn=%~x1 set source_path=%~p1 rem get the file path set destination_path=%~p1 ======================================================================== Can someone tell me how can I achieve what the .BAT file is currently trying to do in a Perl script? I tried doing system "set source_drive=%~dp0"; or $source_drive=system "set source_drive=%~dp0";to try and assign the output of the set command to a variable but that does not seem to work? I do not get the result that am expecting which is the value of %~dp0, instead I presume am getting more like the return code of running the system "set source_drive=%~dp0". Can someone please advise on what am doing wrong and what must I be doing instead? I may have to do the same thing for converting UNIX Ksh script to Perl script. And checking the Ksh script, there is a lot of UNIX commands executed from within the Ksh script that assigns that output of UNIX commands to variable, for example, server=`hostname`, I cannot work out how I should be doing this on Perl, I tried $server=system "hostname" and that does not work as $server when I try to print it gives 0 (zero) which I think is more like the return code for running system "hostname" and not the result that am after which is the hostname of the server. Thanks in advance. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>