Solved

system(..)

Posted on 2001-06-21
12
129 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
Six Sigma Control Plans

691 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