in reply to problem in my sub partition

You're doing the right thing by checking errors - you've made a classic error which is easy to fix. You are off by one in:

for($i=1;$i<=$k;$i++)

which should be:

for($i=1;$i<$k;$i++){

You're not quite done though. As you can see from your current output, you're missing the top of Pascal's triangle:

1 11

Tongue-in-cheek comment: you could try handing this in for your homework and see if you get away with it:

$ perl -wE 'for (0 .. 4) { say 11**$_ }' 1 11 121 1331 14641

-- Ken