Why shouldn't I use shell tools in Perl code? -


It is generally recommended that they do not use additional Linux tools in the Perl code; For example, if someone intends to print the last line of a text file, then they can:

  $ last_line = 'tail -1 $ file`;  

Or else, open the file and read the line by line

  open (info, $ file); While (& lt; INFO & gt;) {$ last_line = $ _ if eof; }  

What are the disadvantages of using the last and why do not I use shell tools in my code?

thanx,

  • Efficiency - giving you a new process Do not need
  • Portability - You do not have to worry about the current executable, accept different switches, or get different outputs
  • Ease of use - You do not have to purge the output, the results are already in useable form
  • error handling - you have errors Ehtr-controlled control and what to do about them in Perl.

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -