Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 300077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:52:52+00:00 2026-05-12T06:52:52+00:00

I want to run and executable ./runnable on argument input.afa . The standard input

  • 0

I want to run and executable ./runnable on argument input.afa. The standard input to this executable is through a file finalfile. I was earlier trying to do the same using a bash script, but that does not seem to work out. So I was wondering whether Perl provides such functionality. I know I can run the executable with its argument using backticks or system() call. Any suggestions on how to give standard input through file.

_ UPDATE _

As I said I had written a bash script for the same. I not sure how to go about doing it in Perl. The bash script I wrote was:

#!/bin/bash

OUTFILE=outfile
(

while read line
do 

./runnable input.afa
echo $line


done<finalfile

) >$OUTFILE

The data in standard input file is as follows, where each line correspond to one time input. So if there are 10 lines then the executable should run 10 times.

__DATA__

2,9,2,9,10,0,38

2,9,2,10,11,0,0

2,9,2,11,12,0,0

2,9,2,12,13,0,0

2,9,2,13,0,1,4

2,9,2,13,3,2,2

2,9,2,12,14,1,2
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:52:53+00:00Added an answer on May 12, 2026 at 6:52 am

    Perl code:

    $stdout_result = `exescript argument1 argument2 < stdinfile`;
    

    Where stdinfile holds the data you want to be passed through stdin.


    edit

    The clever method would be to open stdinfile, tie it via select to stdin, and then execute repeatedly. The easy method would be to put the data you want to pass through in a temp file.

    Example:

    open $fh, "<", "datafile" or die($!);
    @data = <$fh>; #sucks all the lines in datafile into the array @data
    close $fh;
    
    foreach $datum (@data) #foreach singluar datum in the array
    {
        #create a temp file
        open $fh, ">", "tempfile" or die($!);
        print $fh $datum;
        close $fh;
    
        $result = `exe arg1 arg2 arg3 < tempfile`; #run the command. Presumably you'd want to store it somewhere as well...
    
        #store $result
    }
    
    unlink("tempfile"); #remove the tempfile
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Since message isn't grouped, exactly which message from the group… May 16, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer You should be able to include pkg_resources.py in your application… May 16, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer Simply use a Grid instead of a StackPanel: <Grid x:Name="grid"… May 16, 2026 at 11:46 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I want to run an executable and limit its memory and time usage. Of
Guys, this can't be for real I'm trying to make a .NET 2.0 executable
I want to create a static executable that will run on a windows machine
I'm trying to build an executable jar from the command line (I don't want
I am using CMake to generate Visual Studio project files. I want to run
I know I can use subprocess.Popen to run an executable, and potentially redirect stdin
I want to kill an executable of a game named KnightOnline and deny user
I am new to eclipse + Java. I am trying to create executable jar
I'm trying to write a service in c# that should be run on a
I'm not talking about a post build event for a project. Rather, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.