@array = scalarOrList();  
$" = "\n";                
print "Returned:\n@array\n";

print "\nReturned: " . scalarOrList();  # scalar context

sub scalarOrList
{
   if ( wantarray() ) {   # if list context
      return 'this', 'is', 'a', 'list', 'of', 'strings';
   }
   else {               # if scalar context
      return 'hello'; 
   }
}