Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function

 trap
 

Do you know alternative in Perl or actually we don't need it?

Thanks for contribution

I'd start here

1 Like

I did, but I don't know why shell is using trap. It is clean directories and exit

... or to do whatever 'cleanup' needs to be done (based on the script functionality)

1 Like