Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open, read and write to an exe file ? 2

Status
Not open for further replies.

Lulli

Programmer
Dec 11, 2005
14
SE
Hi

There is en file htpasswd.exe used by apache server located in Bin directory. This file is used in order to handle different login functions on the server. I have tried to communicate with this exe file using my perl script that looks like this:

#!C:\Perl\bin\perl.exe
# funktion.pl

use strict;
use warnings;
use IO::Handle;
use File::Spec;
use CPAN;
use Win32::Registry;

system ('C:\Perl\eg\htpasswd.exe -b logg user passwd'); #this one works but I would like to be more flexible and do it like this:

$str = 'C:\Perl\eg\htpasswd.exe -b logg user passwd';
system ($str);

#this one doesn't work, WHY ? I got an error message "$str requires a special package...?

Is there any other (better) way of opening, reading and writing to an external program in Perl.



Thanks

 
Is it because you have "use strict" in operation and the variable has not been declared?
 
It is
Code:
my $str='...';


Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top