Hour 11. System Interaction

 <  Day Day Up  >  

Hour 11. System Interaction

What You'll Learn in This Hour:

  • The system() function

  • Capturing output

  • Portability

All the Perl you've learned up until now has been fairly self-contained: If you wanted something done, you had to do it yourself ”sorting data, creating directory listings, divining configuration information, and so on. The problem is that it's a lot of work, and you're repeating work that might have been done elsewhere.

One of the current buzzwords being touted about Perl is that it's an excellent glue language. What this means is that Perl can use other programs that are installed with your operating system as components , connecting them together to create larger programs. It can start your OS utilities and use them to gather information, interact with you, and then shut them down.

Perl can glue together these smaller utilities to produce a much larger and more useful utility. This capability has the added benefit of allowing you to quickly write code that might otherwise have taken a long time to write and debug. You should use any leverage at your advantage to write code quickly and accurately. Gluing system utilities together can offer a large advantage.

By the Way

The examples in this hour ”for the most part ”have two versions, one for Windows and MS-DOS systems and the other for Unix systems. Where only one example is provided, you'll find a note in the text about what to change for the other kind of system ”and usually that change is minor.


 <  Day Day Up  >  


SAMS Teach Yourself Perl in 24 Hours
Sams Teach Yourself Perl in 24 Hours (3rd Edition)
ISBN: 0672327937
EAN: 2147483647
Year: 2005
Pages: 241

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net