Thanks a lot Lakris...
Code:
#!/bin/sh
scp script.pl user@remote:remote path
result=$(ssh user@remote script.pl)
echo $result
ssh user@remote rm script.pl
i jus swapped the last 2 lines of ur script, cuz it deletes the file before it gets executed.
thanks.