change wracopy from bash to perl