in reply to split...or better?

perl -le '"foo.bar.aaa" =~ /([^.]*)\./; print $1;'

Upd: or just

perl -le 'print "foo.bar.aaa" =~ /([^.]*)\./;'