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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch files

Status
Not open for further replies.

jimmyJIMMYyaya

Programmer
Sep 30, 2001
13
CA
how do i run batch files with perl

right now i tried

system( "time.bat" );

and i only works once i wont run the batch file a second time?

any clue why?

thanks
 
The system function executes the indicated program. You asked
it to do it once, it did it once. If you have more than one program
that you need run, you can loop through them or just explicitly make
a system call to each one.

# looping through
@progs = ('prog1.bat','prog2.bat','prog3.bat');
foreach my $prog (@progs)
{
system("$prog");
}

# OR,
system("prog1.bat");
system("prog2.bat");
system("prog3.bat");

HTH
Please use descriptive titles and check the FAQs.
And, beware the evil typo.
 
heres what happens

sub initialize
{
system( "startTime.bat" );

print "Content-type: text/html\n\n";
}


sub process
{
do some calculations
}

sub terminiate
{
system( "endTime.bat" );

final processes....
}


the first time i call the statTime.bat batch file it works because i think its not in the print "content-type....

the next time i call the endTime.bat batch file its in the print "content-type:....

is that why it wont work properly the when i call the second batch file.

if so how can i end the print"Content-type..." so i can have this batch executed. i can always recode the html header?


note: there is nothing wrong with my batch files.



thanx
-::JjYY::-
 
I don't believe the print and/or content type has anything to do with it. It may have something to do with a shell being called to run the bat file and it not ending properly. Do you really need bat files? What can you possibly be doing in them that you can't just do in the perl program? Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
im using batch files to get the time with milliseconds

if you know how to do this with perl then by all means please explain it. :)



 
from 'perldoc -f time':
For measuring time in better granularity than one second, you may use either the Time::HiRes module from CPAN, or if you have gettimeofday(2), you may be able to use the "syscall" interface of Perl, see the perlfaq8 manpage for details.
"If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Hi,

If you're on NT, take a look at thread:

(new to Perl) How do I build a conn.string to SQL Server 7.0

This might give some idees,

Thierry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top