5

Consider the following snippet of perl in org-babel, which uses <STDIN>.

** Ans 2
   #+begin_src perl :results output
     use Math::Trig;
     $rad = <STDIN>;
     $circumference = 2*pi*$rad;
     print "Circumference of circle is $circumference";
   #+end_src

Is it possible to pipe the input to this block from another block ?

Say :

#+begin_src text :name test-input
  12.5
#+end_src
Nikana Reklawyks
  • 3,233
  • 3
  • 33
  • 49
Vijayender
  • 1,545
  • 1
  • 11
  • 9

1 Answers1

3

You can pass $rad directly to the perl script from a #+results block : see passing arguments to code blocks in the manual.

That would give

#+begin_src perl :results output :var rad=test-input

Using as input

#+results: test-input
:  12.5
Nikana Reklawyks
  • 3,233
  • 3
  • 33
  • 49