This task is to determine if there is only one instance of an application running. If the program discovers that an instance of it is already running, then it should display a message indicating that it is already running and exit.

# For this to work, you need to explicitly
# store the returned fh inside a variable.
var fh = File(__FILE__).open_r
 
# Now call the flock() method on it
fh.flock(File.LOCK_EX | File.LOCK_NB) ->
    || die "I'm already running!"
 
# Your code here...
say "Running..."
Sys.sleep(20)
say 'Done!'