Perform given commands based on mode

Little new to Unix and scripting so bear with me here.

Trying to write a script that takes a few arguments. The first being the mode/permissions of the file (ie. 644,777 etc.), the second being a command (ie. ls ), and lastly whatever optional parameters desired (ie. -l, -n, etc.). So for example a sample running of the script would be "script 777 ls -l". So this would list all files with the permissions 777.

Anyways, I know you can search for files by permission with find but besides that I'm totally lost how to get this to work with ls or any other command for that matter. Any help would be appricated. Thanks

this may give you some clue...

$ cat script
perm=$1
shift
find . -maxdepth 1 -perm $perm -exec $@ {} \;
./script 777 ls -l
-rwxrwxrwx 1 test test 10335 2009-11-11 15:07 ./test.pm