This article will show you what you need to know for communicating with the Arduino in Perl.
This article assumes that you know how to handle serial on the Arduino side. All code here is Perl.
In order to communicate between Perl and the Arduino you're going to need Perl's Device::SerialPort module.
Note that Perl may treat such a string as UTF-8 (e.g. whenever you include umlaut chars or any above ordinal 127).
In those cases your Arduino will receive double the amount of chars you might have expected! Consider to use the bytes pragma in your program code.
Further you should limit the length of the output buffer to chunks of 4096 as there seems to be a limitation within the SerialPort module.
Some pitfalls might await you if you start serious communication. Serious means kilobytes of data to be transferred. The FTDI driver does not seem to be too robust. It will eventually put processes in uninterruptible mode so they can not be killed. Shutdown needs to be forced by pressing the power off button for a couple of seconds! This happened just when utilising the Nano. The driver for the Uno is by far more stable. It was a hard day finding this out. So if you're experimenting with Serial take an Uno, not a Nano.
As long as you Perl program is running your Arduino will also keep on running. But as soon as you stop the Perl process the port will be reset which will eventually cause hiccups on the Arduino. So the best idea is to keep the process alive by inserting a sleep or <> statement right before the exit.