Perl Monk, Perl Meditation | |
PerlMonks |
Re: Using system (); with Strawberry Perlby bliako (Monsignor) |
on Nov 25, 2021 at 12:29 UTC ( [id://11139115]=note: print w/replies, xml ) | Need Help?? |
A quick hack if you have cygwin installed in your computer: run each shell command (grep, mv, etc.) through cygwin's shell, like system("c:/cygwin/bin/bash.exe -c 'rm data2.txt'"); Of course you may be able to call mv.exe, rm.exe by using their fullpath, with something like this: system("c:/cygwin/bin/rm.exe data2.txt");. I am not familiar with cygwin to know if that's possible. If the above works then you can create your own system() to prepend the fullpath to any system command.
Thankfully I do not have any windows computer available within the borders of my estate and so all the above are untested. Therefore it is best to avoid use of rm during testing! EDIT: check also a more elegant rewrite of the above: https://stackoverflow.com/a/55010946 . And also for the bit below, this is an informative post: The problem of "the" default shell BUT! the advice of other Monks is much more sound than using the hack above: rewrite everything in Perl. Actually jwkrahn++ has done the work for you! Apropos File::Grep being slow, show us the codez. bw, bliako
In Section
Seekers of Perl Wisdom
|
|