#in your script you may have something like this if ( $ARGV[0] == 1 ) { # your mp3 playing code }else{ # we run the mp3 code & continue doing what we want/need # like this my $pid = system(1,"$0 1"); # you could monitor the pid yourself and/or kill the process when exiting .. it's up to you. }