I will use modules in this case.
For example:
spliting is my subroutine.
package Mypackage;
use strict;
use warnings;
sub splitting {
..........
return <what you want>
}
Then in the main program.
use Mypackage;
my $a=splitting();
Originally posted as a Categorized Answer.