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

  • SEARCH
  • Home
  • 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 9274737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:25:21+00:00 2026-06-18T16:25:21+00:00

i am trying to remotely execute a perl script that takes data from stdin,

  • 0

i am trying to remotely execute a perl script that takes data from stdin, over ssh.
The tricky part is that i don’t want to upload the script itself to the remote server.
The data that the remote script will read from stdin is produced by another perl script run locally.

Let’s assume the following:

  • my local script producing data is called cron_extract_section.pl
  • my local script that will be run remotely is called cron_update_section.pl
  • both scripts take one argument on the command line, a simple word

I manage to execute the script remotely, if the script is present on the remote machine:

./cron_extract_section.pl ${SECTION} 2> /dev/null | ssh user@remote ~/path/to/remote/script/cron_update_section.pl ${SECTION}

I know also that i can run a script on a remote server without having to upload it first, using the following syntax:

ssh user@remote "perl - ${SECTION}" < ./cron_update_section.pl

What i can’t figure out is how to feed the local script cron_update_section.pl over ssh to perl, AND also pipe the result of the local script cron_extract_section.pl to perl.

I tried the following, the perl script executes fine, but there is nothing to read from stdin:

./cron_extract_section.pl ${SECTION} 2> /dev/null | ssh user@remote perl - ${SECTION} < ./cron_update_section.pl

Do you know if it’s possible to do so without modifying the scripts ?

  • 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-06-18T16:25:23+00:00Added an answer on June 18, 2026 at 4:25 pm

    Use the DATA file handle. In example:

    Local script to be run on the remote machine:

    # script.pl
    while(<DATA>) {
      print "# $_";
    }
    __DATA__
    

    Then, run it as:

    (cat script.pl && /cron_extract_section.pl ${SECTION}) | ssh $host perl
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute a command remotely via SSH from Python, and in this
Im trying to execute a .bat file remotely in a powershell script. The code
I'm trying to a run a python script directly over ssh like this: ssh
I am trying to parse the following JSON string remotely: [{name:Object1,data:[1,2]},{name:Object2,data:[3,4]}] I am doing
I'm trying, unsuccessfully, to remotely execute an SSIS package. The package resides on a
I am trying to execute a .bat file remotely and implementing following lines of
I'm trying to open a video file (flv) that is being hosted remotely. When
I'm trying to run a bat file remotely (from XP to 2003) and running
I'm trying to install some software remotely from our domain server to all the
I am trying to write some code to remotely grab some basic reference data

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.