You've hit an overflow. 2150004800 is bigger than 2^32/2. Due to the way computers handle positive/negative numbers, you end up with a negative number.
Try this and you should get a positive result:
my $var1alt = sprintf("%014d", $var1);
my $var2alt = sprintf("%014u", $var2);
The 'u' tells Perl to treat the variable as an unsigned integer.
See http://en.wikipedia.org/wiki/Printf for a detailed description