Agi perl script stdout variable send back

Using AGI you have a STDIN & STDOUT. When in AGI Perl Script how do you send

a variable back to asterisk. I am using agi=>stream_file($filename,$digits,$offset).

When the digits are keyed in and collected in $digits, how do I get that variable back

to Asterisk and save the value in a variable there?