[EMAIL PROTECTED] wrote: > Hi all, Hello,
> 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: You probably want File::Spec and File::Basename: perldoc File::Spec perldoc File::Spec::Win32 perldoc File::Basename [snip] > 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". perldoc -f system > 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. use Sys::Hostname; my $server = hostname; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>