Solved

system(..)

Posted on 2001-06-21
12
128 Views
Last Modified: 2010-03-05
In an NT DOS box, command "call a.bat args" works fine.
In a perl file (b.pl), I do
system("call a.bat args");
I get (perl b.pl):
The name specified is not recognized as internal external command...
How should I do this?

Thanks
0
Comment
Question by:txholdem
  • 5
  • 4
  • 3
12 Comments
 
LVL 8

Expert Comment

by:shlomoy
ID: 6214438
which name is not recognized?

perl?
call?

0
 
LVL 1

Author Comment

by:txholdem
ID: 6214543
actually I just realize that it's the file path thats causing the problem. I did not use double back-slashes.
Thanks anyway.
0
 
LVL 1

Author Comment

by:txholdem
ID: 6214670
shlomoy,

I will credit the points if you would tell me how to do this is perl:

perl a.pl arg1 arg2 arg3
in a.pl, how do I obtain arg1, arg2, and arg3?

Thanks in advance.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 8

Expert Comment

by:shlomoy
ID: 6215098
$ARGV[0] is holding arg1
$ARGV[1] is holding arg2
$ARGV[2] is holding arg3
0
 
LVL 1

Author Comment

by:txholdem
ID: 6215344
I already got the answer from another expert.
How about you tell me how to make this line work?

unlink <$tmpdir."\\*.out">;

Thanks
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 6215408
> I already got the answer from another expert.

Where?

> How about you tell me how to make this line work?

Are you toying with me?
You do ask a lot of questions for 30 lowsy points :-)


About the line
     unlink <$tmpdir."\\*.out">;


Here is the perldoc entry for unlink():


       unlink LIST

       unlink  Deletes a list of files.  Returns the number of
               files successfully deleted.

                   $cnt = unlink 'a', 'b', 'c';
                   unlink @goners;
                   unlink <*.bak>;

               Note: `unlink' will not delete directories unless
               you are superuser and the -U flag is supplied to
               Perl.  Even if these conditions are met, be warned
               that unlinking a directory can inflict damage on
               your filesystem.  Use `rmdir' instead.

               If LIST is omitted, uses `$_'.          


can you describe me what $tmpdir is?

I suppose that '\\' is something related to windows... right?

if the meaning of '\\' is another filesystem, than, as you can read from the perldoc entry, unlink will not work.
0
 
LVL 5

Accepted Solution

by:
Sapa earned 30 total points
ID: 6215419
unlink eval {<$tmpdir\\*.out>};

or

unlink glob("$tmpdir\\*.out");

- Sapa
0
 
LVL 5

Expert Comment

by:Sapa
ID: 6215443
to shlomoy:

what purpose you need these points for? I have 610 question points and don't know what to do with them, in any case I will never ask questions here :-))

- Sapa
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 6215503
> what purpose you need these points for? I have 610 question points and don't know what to do with them, in any case I will never ask questions here :-))

It's the principal...

And besides... no t-shirt beyond 100k points anyway - and I've passed the 100k points as it is, so you can be sure I get no reward from answering questions. Obviously I do it for fun.
0
 
LVL 5

Expert Comment

by:Sapa
ID: 6215523
"no t-shirt beyond 100k points anyway".

Re-register with new nickname and get t-shirts for every 5k points :-)

- Sapa
0
 
LVL 1

Author Comment

by:txholdem
ID: 6215557
I am sorry, I have to give this one to Sapa..
(it should be unlink glob($tmpdir."\\*.out"); though)

Shlomoy,

I closed the question (another thread) on @ARGV earlier, since I was in a hurry. I actually deleted this thread afterwards.. I am not toying with you. Sorry.
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 6215588
ahhh... no point registering again, and sesides - they didn't even give me the 100k points t-shirt... :-(

I do this for fun.

txholdem, take it easy :-)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
perl script to count sepecial characters in a file 7 146
Perl efficient DB Call 8 87
PERL - Find newest folder 12 135
Perl File::Find alternative 1 69
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question