Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

perl script to execute a single command for multiple entries

by noviceuser (Acolyte)
on Nov 24, 2020 at 05:47 UTC ( [id://11124112]=perlquestion: print w/replies, xml ) Need Help??

noviceuser has asked for the wisdom of the Perl Monks concerning the following question:

I need to delete multiple clients using command: p4 client -d <client-name>, so i want to write a perl script where i can read a file containing list of all the client names, and delete the same using the script.

Replies are listed 'Best First'.
Re: perl script to execute a single command for multiple entries
by GrandFather (Saint) on Nov 24, 2020 at 06:01 UTC
    so i want to write a perl script

    Sure, go for it, I give you permission. Was there anything else you wanted?

    To put it another way: where are you having a problem? What have you tried already and how did it fail? The more effort you put into your question the better the help you will get. As a general thing we don't do your work for you, but we often go to extraordinary lengths to help you understand how to do things for yourself - give us that chance.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
Re: perl script to execute a single command for multiple entries
by haukex (Archbishop) on Nov 24, 2020 at 18:41 UTC
Re: perl script to execute a single command for multiple entries
by stevieb (Canon) on Nov 24, 2020 at 22:32 UTC

    See the open documentation on opening and reading a file, and the unlink documentation on deleting files.

Re: perl script to execute a single command for multiple entries
by perlfan (Vicar) on Nov 30, 2020 at 19:14 UTC
    Seems more like a shell script. If you want to use Perl, then you can do it using any number ways for Perl to generate child processes. Based on your description I recommend system or if you have multiple CPUs (or vCPUs), use fork via something like Parallel::ForkManager. I am assuming non-Windows, is that okay? :D

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11124112]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found