in reply to Problem using | char as delimiter for split

You have two main problems. First | is special in regexes, escpae it:
...split /\|/, $a;
Second, on output, you are not putting anything between the numbers, add some new lines:
print "$num1\n"; ...
Phil