Replace shellcmd calls with file operations in Perl.