in reply to System call in Windows
Try the following:
Then run the code like so:
Update: Thanks for the reference to the -pi flags. I understand now. The while loop is superfluous with the -p and the -i will edit the file given in place. Why does he need a system() function call around the whole thing? Won't that spawn another shell?
#!/usr/bin/perl while (<>){ s/CAT/mouse/g; print; }
Then run the code like so:
prompt> perl -w myscript.pl 'D:\tmp\file.txt' > D:\tmp\file.txt
Update: Thanks for the reference to the -pi flags. I understand now. The while loop is superfluous with the -p and the -i will edit the file given in place. Why does he need a system() function call around the whole thing? Won't that spawn another shell?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: System call in Windows
by runrig (Abbot) on Oct 24, 2008 at 19:37 UTC | |
Re^2: System call in Windows
by csarid (Sexton) on Oct 24, 2008 at 19:58 UTC | |
Re^2: System call in Windows
by NateTut (Deacon) on Oct 24, 2008 at 19:54 UTC |
In Section
Seekers of Perl Wisdom