Perl script to move files not in use

I need to write a script to move files only when they are not in use. I have a rudementry bash script for Linux but i need a perl script so it will work on Linux and hpux. Oracle writes files to a directory called /data and the files there are moved every 5 minutes to a new home. But i need to only move the files that oracle is not currently writing in the /data directory. Usually i have a script that partially works but i do not know where to start here (i am bad with perl). Any help would be appreciated.

Thank You,

Sean

How are you going to see what files are in use? In linux you can do: lsof to see.. so I would start there..

In linux I would get the list by doing:
inuse=$(lsof | awk '$(NF) ~ /\/data/ {print $(NF);}');

Then comparing what was in data to it, and moving the files that weren't in use to a new location.