1

Im trying to execute a perl script as a passed argument from the command line. I compiled a c file and named it "Test", so trying to pass an argument I try this

>Test perl -e "print qq{A\n}x500"

which I want to mean, run Test file and pass 500 A's, but it seems to not be working

Eric
  • 103
  • 6

2 Answers2

3

Why do you think it should work? It runs Test and passes 3 arguments to it - perl, -e, "print qq{A\n}\x500". In bash it would be:

Test `perl -a "print qq{A\n}x500"`

For windows, there is no simple way to get a programs output as a variable or pass it to another command directly.

See this post, it describes how set a commands output to a variable.

Community
  • 1
  • 1
khachik
  • 28,112
  • 9
  • 59
  • 94
2

Try using a pipe, you were latterly passing perl -e "print qq{A\n}x500" to Test.

Example of using a pipe :

perl -e "print qq{A\n}x500" | Test
OneOfOne
  • 95,033
  • 20
  • 184
  • 185