Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl uses? 6

Status
Not open for further replies.

itech2004

IS-IT--Management
Jan 23, 2004
103
US
I would like to learn perl, but would like to know if someone could give me some examples perl is used for on a window os. I know it could be used with web pages, but would like to know what other uses is it good for, and what is the difficulty rating of learning perl.
 
Well the best idea is to go to and download the latest version of ActivePerl.

As well as the perl interpreter / compiler you get a fantastic HTML book with lots of information to get you started and once going an invaluable resource for programming.

You will see that perl interfaces with OLE and is able to manipulate word docs, excel spreadsheets etc.

You can use ppm (perl package manager) to fetch more modules or libraries than you can poke a stick at including ones that allow the building of GUI apps in Windows.

So the best thing to do is try it - after all it's free.

Good luck and all the best.
 
I like perl because it gives me a power level close to assembler, is good for text/string processing and handles real numbers well. The trick part when learning is that many sample pieces of code is written by what I call perl-ies. They code with the smallest integrated pieces of code that it makes it hard for a new programmer to learn. Example: there are ways in one command to search for a sub-string in a long-string and do something with it like substitution/upper-case/extract etc. For new programmers it might be better to learn the simple loop, increment, look/compare, do-something and continue the loop. Their way is faster but not preferred by auditors & documenters. Of course these are just my opinions.

I can use perl in a batch mode to write filters and other business report programs. Look


at for a sample of a business perl program showing an inventory status. Ignore the banner on this free site.

Here are two books I use in a web coding class. they are small, have a good introduction and are fairly cheap.

THE WEB WIZARD’s GUIDE TO PERL AND CGI;
DAVID D. LASH; ADDISON-WESLEY PUB.CO ISBM: 0-201-76436-9

THE WEB WIZARD’s GUIDE TO FREEWARE & SHAREWARE;
WENDY LEHNERT; ADDISON-WESLEY PUB.CO ISBM: 0-201-7417-7
 
It's like slang in code. Outsiders have a hard time understanding, but those in the crowd and culture know it well. Sometime's it gets flaunted, like the "cool" kids who need others to know they're cool, but sometimes it just slips out. Most people here helping others make pretty clear code in examples, as I'm sure books do. Personally, I know I tend to abuse $_ more than neccessary.

Perl is an interpreted-ish language, so that means most of it's work is done either via the web, like cgi or mod_perl, or completely in-house projects, where you know you'll have the proper environment. Sure, you could use PAR and make executables, but it's still pretty rare to see such programs about. It's popular amongst system administrators since it takes the task of shell, sed, and awk pretty well (and brings the power of those tools to Windows).

It's a fun language to use and learn. It's set up so that all you have to learn is the subset of the language you're going to use. You can have two expert perl programmers that don't know each others' skill set at all.

So much of Perl's power comes from CPAN.org, a huge archive of free to use code. Bets are good if you have a strange task to do, you're not the first, and someone's written a module to do the bulk of it. It's an amazing time saver. Connect to your databases with DBI, then change database servers. You often only have to change the connect line in your code, the rest works the same because DBI makes the conversion transparent.

I guess the question is, what do you want to do with Perl? While I'm sure Perl can do it, it may not be the right tool for you.

________________________________________
Andrew - Perl Monkey
 
Also, just browse this forum and see what kind of questions people are asking.. It should give you a good idea of what kind of things people are doing with perl.

I was asked to write a simple script at work recently - it just watches a directory for certain file types, then when someone places a file in the directory, it moves it to another directory based on the file extension. It also keeps a timestamped logfile of what files were moved where.
Something like that could be a good exercise if perl is your first programming language.
Perl was my first language, and it took me about a year to learn enough to make it my full time job, and I haven't even scratched the surface. But so far I've been able to figure out how to do anything I've set out to do - and I learn something new almost every day.

It all started because my job consisted of some really mundane tasks, like having to rename 50 files at a time. Now it would take me about 2 minutes to write a script to do it automatically. I've found so many things at work that can be automated with perl that I can barely keep up with it.
 
I would like to say thanks for every ones input, it sounds like perl is a very powerful language. I guess I could assume that data base administrators get the most out of perl.
 
I just brought up DBI as an example. If you browse around job listings, you'll see Perl listed in two ways: "Perl/PHP" or "Shell/Perl". The first is for web design, cgi, mod_perl, and other such things. Basically dynamic web pages (most of which have some database connectivity, session management, etc). For example, Amazon.com is run with Mason, an application framework using Perl. The latter are system administrators who use Perl for user/file/database/etc management. For example, a kernel compile in FreeBSD is/was a big series of Perl scripts.

Really, the reason to use Perl is CPAN. Databases, session management, parsing command line options, parsing xml/html, writing your own parser, CGI i/o, apache handlers, terminal escapes, are all examples of topics that have powerful full-featured modules available. It's Perl's "killer app", a resource no language has been able to top.

________________________________________
Andrew - Perl Monkey
 
I started out with these two books:
Learning Perl, 3rd Edition
ISBN: 0-596-00132-0

Perl in a Nutshell, 2nd Edition
ISBN: 0-596-00241-6

I don`t know if they are the best for you, but I am satisfied.
(I use the last one almost every day, maybe becouse I have a bad memory ;) )


Good Luck!
 
Another good book to have if you are serious about learning
Perl over time is a Perl Bible like PERL BLACK BOOK by
Steve Holzner at CoriolisOpen Press. ISBN:1 57610-465-6

It lists about $50 but contains just about everything, like an
encyclopedia, but in an easy to learn format. Each statement
is introduced by as a “situation story” describing how a
manager wants something programmed and you are introduced
to the next statement to do the required function.
 
Man, you guys are leaving out all of the most important stuff for using perl on windows. I have almost completely replaced dos batch files with perl. I use it to script automated installations of programs, access and change remote registry values, synchronize remote file servers, cleanup old files in directories, and the list goes on.
 
At my last job, I wrote an entire directory transformation suite of programs using perl, to integrate 30,000 email mailboxes from one organisation to another. It's totally brilliant at text and file manipulation. Now I use it for stats gathering, capacity planning scripts, I even have a perl utility to collect backup logs from each server in the organisation, parse them for error messages, and then finally it sends me a consolidated report every morning with all the failures listed and probably causes for each failure extracted from a history of previous failures. I don't know how I'd manage without perl, hardly a day goes by without me writing one bit of code or otherwise in it. And this is a support job!
 
Im a Cisco Engineer. I use perl within HP Openview to send me Email Alerts to Critical and Major alarms. I use it to parse Firewall logs and Radius or Tacacs logs. I generate reports on log files and manipulate files to place in a spread sheet or Database. I also use it to create large parts of Cisco config files to stream line the configuration of large network deployments.

I also sometimes use to parse or manaipulate large Spreadsheets.

I have also used it to create CGI reports of log files for management.

If you know C, or any other structured programming lng., then learning perl is a little easier.

NetEng

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top