#!/usr/bin/perl -w use strict; my $var = ''; while(<>){ $var .= $_; } # Do stuff with $var