Call a perl script inside a shell script

Hi all,

I have the following snippet of code..

#!/bin/sh

echo "run perl script............"

#Run the verification script
perl bill_ver

echo " perl script completed....."

echo "rename files......"

#Remove from all file in the directories test, test1, test2, test3
for f in /usr/users/rovolis/test/.tmp ; do newfile=`echo $f | sed 's/\(.\)..../\1/'` ; mv $f $newfile ; done
echo "rename completed....."

The perl script returns '0' if it is completed successfully or non-zero if not.
What i would like is to perform the rename only if the perl script is completed successfully. How am i going to check this?

Thank you very much for your help

Use the $? variable right behind the "perl" command to store the returncode of the perl-process. Store it in another variable and do an if later?

Could you please be more specific?
I tried the above but it doesn't seem to work.

Thank you very much

#!/bin/sh

echo "run perl script............"

#Run the verification script
perl bill_ver

ret_val=$?

echo " perl script completed....."

if [ "$ret_val" -eq 0 ]
then

echo "rename files......"

#Remove from all file in the directories test, test1, test2, test3
for f in /usr/users/rovolis/test/.tmp ; do newfile=`echo $f | sed 's/\(.\)..../\1/'` ; mv $f $newfile ; done
echo "rename completed....."

fi