#!/usr/bin/perl -w use strict; my $output; open (OUT, ">", \$output) or die "can't open scalar for out"; print OUT "this is some line\n"; print OUT "this is another line\n"; print "printing the output variable:\n"; print $output; __END__ OUTPUT..... printing the output variable: this is some line this is another line