Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

run a program on a file using sytem call

by shaludr (Initiate)
on May 04, 2010 at 15:43 UTC ( #838337=perlquestion: print w/replies, xml ) Need Help??
shaludr has asked for the wisdom of the Perl Monks concerning the following question:

Here is the edited version of the question. I am sorry guys I m just learning how to post here.

I am fairly new to Perl and I want to Write a script that runs 1234( a program stored in, on each of the files stored in the abc.txt file.

this is what i could think of :

#!/usr/bin/perl -w open FILE, "abc.txt" or die $!; while (<FILE>) { script should go here }</p> close (FILE);

script should have something that will read the lines and then run on it.... does anyone know how to do it ? Thanks

Replies are listed 'Best First'.
Re: run a program on a file using sytem call
by kennethk (Abbot) on May 04, 2010 at 16:04 UTC
    Please read How do I post a question effectively? and Writeup Formatting Tips. Ill-formatted and unclear questions are less likely to get you useful answers. In particular:
    • please wrap code in <code> tags.
    • what do you mean by "processes the names"?
    • histrionics actively discourage monks from helping (i.e. "HELP!!!")

    Assuming you have a script named "" that "processes the names", the answer to your question can be found in perlrun in the form of a command-line switch.

Re: run a program on a file using sytem call
by MidLifeXis (Monsignor) on May 04, 2010 at 17:08 UTC

    If this is homework, indicating such, showing what you have tried, showing your thought process, and other documented efforts will garner much more help than a "please write this for me" type of request.


Re: run a program on a file using sytem call
by Illuminatus (Curate) on May 04, 2010 at 15:46 UTC
    Isn't this what TA's are for?

      @Illuminatus : Yes TA's are supposed to help, provided we have some. I just said I m new to perl so I dont know how to get started with these things. Thank you for replying back

      @kennethK : thankyou for replying back I have edited my question and I hope this makes sense now. If you start telling me how to do things I will write my code on my own. I dont want any one to write a code for me.

      @MidLifeXis: Yes this is a part of homework, I wanted a basic idea to do this. I am not expecting anyone to write a code for me. That is plagiarism. I dont have computer brains to help me figure out stuff that is why I came here to ask for help. Thanks for your valuable time

Re: run a program on a file using sytem call
by Jenda (Abbot) on May 10, 2010 at 13:25 UTC

    Have a look at the system() builtin (perldoc -f system), the chomp() builtin and the $^X variable described in the perlvar manpage.

    Enoch was right!
    Enjoy the last years of Rome.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://838337]
Approved by kennethk
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2017-05-29 18:18 GMT
Find Nodes?
    Voting Booth?