my $variable = results(); sub results { # ... do something that will give $foo the stuff you want # to return ... return $foo; }