Programming question of the day...

So I was posed with the question of how to return an array reference in Perl using split on only one line. Here's how I solved it. The trick is to use square brackets on split. Otherwise you get an array instead of an array ref.
#!/usr/local/bin/perl

use strict;
use warnings;
use Data::Dumper;

sub foo($);

sub foo($) {
  return [split(/\s+/, shift())];
}

my $str = "1 2 3 4 5";
print(Dumper(foo($str)));