in reply to Passing an in memory scalar to an external command as an argument

In Perl, you can open an internal Perl variable with a file handle to read it like a file. Instead of a file name, you use a reference to the internal Perl variable name. You can also use this technique to print to an internal Perl variable. This is often a good technique to avoid the complications of creating temporary files. If the program "bombs", there are no extra files to clean up later.

open (MP3, '<' , \$mp3file) or die $!; binmode MP3; #more than one way to do this print MP3;
yourprogram.pl > binaryfileconsumer;
  • Comment on Re: Passing an in memory scalar to an external command as an argument
  • Download Code