my @lines = foo( 'bar' ); chomp @lines; my $a = join '', @lines; my $b; $b *= getVa( $_ ) for @lines; undef @lines; #### sub foo{ my $bar = shift; my( $a, $b ); ... while( my$line = getLine() ) { chomp $line; $a .= line; $b *= getVa( $line ) } return $a, $b; } my( $a, $b ) = foo( 'bar' );