Capture data in a file

How to capture the rows in a file after executing the store procedure using the perl scripts?