Would the below code to it for me
I think you should answer that question. When you run your code, does it work the way you expect? If not, you should try to explain to us
how it deviates from your expected behavior. Since we do not know what's in one of your input files ("temp3"), we can not run your code.
General suggestions:
- Use the strictures: use warnings; use strict;
- Are you trying to win the "useless use of cat award"?
How about just system 'grep hdlcppp temp3 > hdlc1';
- It is good practice to check the status of your open and system calls.
- If your "hdlc2" file isn't too big, it might be more efficient to slurp it into an array once, rather than having to open it and read it for every line of your "hdlc1" file. This would also avoid potential confusion of using $_ in your nested "while" loops.
- Your system "touch hdlcget" seems unnecessary.
- Also consider replacing some system calls with Perl built-ins, such as chmod and unlink to minimize shell invocations. See also UNIX 'command' equivalents in Perl
Update: added chmod/unlink