#!/usr/bin/perl -w use strict; sub return_value { return "" unless wantarray; return ("this is a value", "xxx", "yyy", "zzz") ; }; my $stuff; for ( return_value() ) { chomp; s/foo//g; tr/x/y/; $stuff = $_; } print "\$stuff >$stuff<\n"; $stuff = return_value(); for ($stuff) { chomp; s/foo//g; tr/x/y/; } print "\$stuff >$stuff<\n"; # the output __DATA__ $stuff >zzz< $stuff ><