bronto has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks
I work as a System Administrator, and I extensively use Perl every time that this means that it can help me to accomplish my job faster, automatically or more easily, that means: often.
Of course, I know how to make some shell scripting and I know how to mix grep, awk, sed together but...
...but I feel that it would be a good thing to know another programming language besides Perl, too.
I tried to think about it, but there is too much noise around (Java! Java!, or use Python!, or why not PHP?)... so much noise that I can't understand what is the good answer to the question:
Any good advice?
Thanks a lot
Ciao!
--bronto
In theory, there is no difference between theory and practice. In practice, there is.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Learning ***** as a second language
by gellyfish (Monsignor) on Aug 12, 2005 at 09:40 UTC | |
I would recommend C if you are working on Unix-like systems being the language that most stuff (including Perl) is written in. At the very least knowing C means you can tweak programs that you might want to use. I guess if you are using Windows you might want to consider learning C# which is likely to become the default "Scripting language" in forthcoming versions of WIndows. /J\ | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by neniro (Priest) on Aug 12, 2005 at 09:26 UTC | |
I tried a bunch of other scripting-languages and suggest you to try ruby cause it really rockz! UPDATE: Maybe http://www.pugscode.org/ is interessting to you, cause it gives you the opportunity to learn perl6?! | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by Taulmarill (Deacon) on Aug 12, 2005 at 09:37 UTC | |
the intention behind Perl was to build a scripting language that could do what bash, awk, sed and all the other tools could do, which wore around about 20 years ago. so learning php, phyton or ruby is not a bad idea, but i don't think it will give you mutch benefit over Perl. maybe it would be a good idea to learn something different, which can do things you can't with Perl. let's say JavaScript for browser scripting or C for compiled stand alone programs which are way faster that Perl scripts. also you could benefit from C by using Inline::C in your Perl scripts. | [reply] [Watch: Dir/Any] |
by neniro (Priest) on Aug 12, 2005 at 09:44 UTC | |
You're right on this, but learning another scripting-language helps to get another perspective. I started using anonym functions after I learned about lambdas in python and I learned about Mixins after I saw them in ruby - so it can be a benefit to learn other languages, even if their possibilities aren't much different to those of perl. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by hatter (Pilgrim) on Aug 12, 2005 at 10:27 UTC | |
the hatter | [reply] [Watch: Dir/Any] [d/l] |
Re: Learning ***** as a second language
by xdg (Monsignor) on Aug 12, 2005 at 10:31 UTC | |
I think it depends, in part, on where the scope of your responsibilities lie and what kinds of tools are already in use on your system and in what languages they are written. The rationale for this is that if you have to go beyond scripting administration tasks to debugging administration tools, you'll want to be familar with whatever language those are written in. For example, a lot of the system configuration tools on a Fedora/Redhat system are coded in Python, so knowing that might help debug those tools if you encounter a problem. On the other hand, if you're maintaining a Horde/IMP installation (or other PHP-based web interfaces), then knowing PHP will come in handy. I wouldn't get too caught up in what language are "cool" -- I'd focus on what other languages are in use around you every day. -xdg Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by jhourcle (Prior) on Aug 12, 2005 at 12:33 UTC | |
You didn't mention what type of system administrator you are, or what languages you may know other than Perl, but from the mention of grep/awk/sed, I'll assume you maintain some form of posix system. If you're maintaining 'older' systems (any OS that doesn't ship w/ perl by default), I'd highly recommend that you learn to script in the appropriate shell for your system. Although they're all a little bit different, learning the syntax differences between ksh/csh/bash/etc. can be useful -- even if not because you're writing your own scripts, to debug other people's scripts that screw up when you go to install them on your system. Sometimes, perl can be overkill for quick scripts ... unix shell has branching, loops, procedures, etc, and can do a whole lot more than people use it for. I typically have my cron jobs call shell scripts, which set up the environment, and then pass off to perl or whatever else. C can also be very useful ... learn what the various compiler errors mean, even if you never write a C program in your life, as you don't want to be in the situation where you're told to install something, only to find out that it has a dozen dependancies, which are spewing errors. If you're also a windows sysadmin, then I'd probably move to learn VB, even with the horrors I have from my year of VBA programming. (functions, or objects... pick one ... what the hell is up with with 'DoCmd' object?). As there are lots of different types of system administrators, I'd suggest you look at what it is that you do, and determine where you seem to be taking longer on tasks than you feel is appropriate ... from that, you can get indications of what sort of things you feel you can make improvements on, and give you a hint as to what sort of things you need to learn. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by tlm (Prior) on Aug 12, 2005 at 13:02 UTC | |
I pretend to be a sysadmin for my home system (Linux Debian). I totally disagree with the statement that Perl is the only scripting language that one needs to know as a sysadmin, because a sysadmin not only has to write his/her own scripts, he/she must be able to understand the code written by others, and much code one runs into while doing sysadmin work (at least in the Linux/Unix universe) is not written in Perl. IME, I find that being able to understand bash scripts and have a clue about how to edit these scripts is a an absolute must in the Linux universe. Next in the list is C. After that it's a toss up between Python and C++, though Python is gaining the upper hand. (Just not to confuse anyone, I don't mean to imply that C and C++ are scripting languages; I'm just referring to the frequency with which I've had to be able to grok a non-Perl language in order to take care of a sysadmin task, irrespective of the specifics of the language.) the lowliest monk | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by izut (Chaplain) on Aug 12, 2005 at 11:42 UTC | |
I was thinking about this few days ago. I just can say I can't use any other technology after meeting Perl. As neniro said, there are nice things in Python, Ruby, Java and PHP, but my opinion is Perl can do everything they can, but those can't do what Perl does. So, my suggestion is: learn other usage for Perl than sysadmin scripts :-) There are a plenty of nice modules in CPAN that does about everything: from resolving card games to complex web applications, workflow control, etc. Improve your knowledge doing that, you'll see Perl always will surprises you ;-). Update: After reading mrborisguy reply, I must emphasize that I am a former Java and PHP developer with unix background. The above text applies to me. I tried to perform the same tasks I do with Perl in Ruby, Python and Java but it really disappointed me. I think the only aditional language I would invest my time with is Ruby (after trying Ruby On Rails, but I switched back to Perl after I discovered CGI::Application and Class::DBI ;-)
Igor S. Lopes - izut surrender to perl. your code, your rules. | [reply] [Watch: Dir/Any] |
by mrborisguy (Hermit) on Aug 12, 2005 at 12:44 UTC | |
neniro said this earlier, and I completely agree with him. Perl is an incredibly powerful language that can do nearly anything. However, learning other languages helps any programmer think in different ways, which ultimately leads to finding the best solution for a problem more often. Some people rave about functional programming. Other people rave about Object Oriented Programming. Other people rave about AI programming. Other people rave about this and about that. It's true that a programmer can get Perl to do all of those things, if said programmer understands all of those things well. Learning other languages gives any programmer those tools because he or she understands the concepts and the best way to do things in that style from learning a relevant language. Learning other languages brings that all back to Perl to make the programmer more effective. If the programmer were just expanding his or her knowledge of Perl, sure, they'd end up picking some of that up just from Perl, but the programmer wouldn't have the deeper understanding of it, so would feel less comfortable using it to solve a problem. -Bryan | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by uksza (Canon) on Aug 12, 2005 at 09:30 UTC | |
I think there isn't better language for sysadmins for Perl. So, I think you only can start learn/use C - for improve your Perl programs ;-) uksza | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by GrandFather (Saint) on Aug 12, 2005 at 10:48 UTC | |
You already have a good idea of what scripting languages are about, so I'd suggest you take a look at C/C++. Perl is Huffman encoded by design. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by radiantmatrix (Parson) on Aug 12, 2005 at 13:35 UTC | |
If your focus is primarily on System Administration, Perl gives you the greatest flexibility of any cross-platform language I know. However, despite my personal distaste for .NET, it is an excellent platform to get used to if you work ever need Windows-specific applications (esp. if you need to do advanced work with Active Directory). If .NET doesn't jingle for you, I recommend Java. Again, I personally dislike the language; but, it is a cross-platform language that has free (and Free) compilers and runtime environments. It's used in many places for automation and security work, so it's a good skill on a resume, and it's not far off from MS's C#.NET if you end up needing to go that direction. If you have solid Java (esp. WebSphere and Tomcat) experience and solid Perl skills, you'll never have trouble finding a job. However, if you simply want to challenge yourself, stretch your brain, and improve your overall programming ability, I suggest LISP. It seems like most of the popular languages are becoming more like LISP on a daily basis, anyway.
<-radiant.matrix->
Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P) The Code that can be seen is not the true Code "In any sufficiently large group of people, most are idiots" - Kaa's Law | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by Koolstylez (Scribe) on Aug 12, 2005 at 13:43 UTC | |
If you aren't too interested in the theoretical stuff, and you don't know C/C++, those are a good place to start since they are quite widely used. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by samizdat (Vicar) on Aug 12, 2005 at 14:07 UTC | |
C is essential to understand UNIX. It's also necessary to understand modules built with XS and swig. Look especially at make. It's not a 'real' programming language, but it's a really useful tool. Another useful tool for sysadmins, though you can equal its functionality with Net:SSH et al, is expect. expect is just the cat's meow for using Perl to massage other systems as though you were sitting at the keyboard. Highly recommended, and, of course, there's a Perl module to talk to it! | [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Learning ***** as a second language
by bofh_of_oz (Hermit) on Aug 12, 2005 at 14:17 UTC | |
Second, there is not enough information supplied to answer the question properly... so the answer is "it depends" Perl has so much flexibility that you can use it for almost anything (note the "almost" part). There are many other languages, each serving their purpose, and they tend to be somewhat more narrow-focused. So you know shell scripting (and perhaps batch scripting on Windoze) and want to delve into the realm of *real programming* languages... If you mostly work on *NIX computers, I would strongly recommend to learn C followed by C++. You can think those are old languages, but so far no newer languages can beat them in system programming field (just my opinion of course). If you're in the Windows realm, you can learn Visual Basic for dealing with Databases (IMHO it's the only thing VB is good for - easily make connections to MSQL DB and manipulate data in visual way). VBscript is somewhat useful for pulling information from systems and Active Directory (using WMI). For Web-oriented programming, Java is the most advertised/marketed language, even though a little cumbersome (MS JVM vs SUN JVM, applets security etc etc). PHP and Python are pretty good languages too, but if you want to "increase your marketability" as well, pick Java... However, the main thing about programming (again, personal opinion) is not about knowing a particular language. It is about being able to think logically - identify the problem/find its cause/devise logical solution/implement in the most appropriate way. If you know and can create block diagrams (the logical flow of a process/program/whatever), you can take a book on any language to learn a syntax and be able to implement your solution in the matter of days (or less if you already know the language). That being said, I would recommend you to get a few books on the topic of programming itself, not restricted to a particular language. When you understand the general concepts, use the language you want to get what you need.
--------------------------------
| [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by willyyam (Priest) on Aug 12, 2005 at 16:25 UTC | |
You've raised a good question, and you've gotten a lot of great answers, so I won't bother you with repeated advice. Instead, I'd suggest not another language, but learn your editor of choice. If you use vi or vim there is a vast wealth of power and utility, and once you start learning how to tap into it it will make a significant difference in your life every single day. Vi(m) scripts, perldo, folding, block editing, tagging and multi-file editing - these can really change the way you work for the better. If you use emacs, then you have a wealth of power over data that simply boggles the mind. This editor attempts to do everything, and largely succeeds. As a byproduct of learning emacs, you'll likely learn LISP, so that's all right too. If you are not using one of these editors, then start. They are the power tools - learning curves like the Matterhorn, but worth every minute of the climb. Whatever you tackle next, good luck. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by Arunbear (Prior) on Aug 12, 2005 at 09:46 UTC | |
| [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by Anonymous Monk on Aug 12, 2005 at 15:33 UTC | |
I'd say, for a Unix system administrator (and I've been one for over 15 years on a variety of platforms, including Solaris, (old) SunOS, HP-UX, Linux, AIX, and IRIX), shell and C are a must. And another (scripting) language to write your own stuff in, like Perl, Python, Ruby, Rebol, etc, is very useful. I'd hire someone without Perl knowledge as a Unix system administrator (although knowing Perl would certainly be welcome). I wouldn't hire someone without C knowledge. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by punkish (Priest) on Aug 12, 2005 at 17:44 UTC | |
French, because is sounds so good. Chinese or Hindi, in case you have to work with Chinese or Indian techies knowing their language will make it all more fun. Besides, traveling through either China or India while knowing the local language would be a pretty amazing experience. Otherwise, the other 45 responses all have very good suggestions.
--
when small people start casting long shadows, it is time to go to bed | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by InfiniteLoop (Hermit) on Aug 12, 2005 at 13:50 UTC | |
I suggest you familiarise with:
| [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by BaldPenguin (Friar) on Aug 12, 2005 at 14:41 UTC | |
First, I have been coding for close to 10 years now. Relatively young compared to some of my esteemed brethren. In those years, I started with BASIC, then on to Visual Basic, JavaScript, ASP and then Perl. Then I became a moved over to what some would say is the dark side. Going through a rough time in the dot.bomb phase, my company had given me charge of a team of developers. Good guys, but no one knew Perl, 'oh and BTW the next project will be in Java, Have Fun!', I learned Java. And then on to C# and others. To cut the story short, all of them made me a better Perl programmer.Learning how to do, or not to do, the same sames in other languages can give you a better grasp of the patterns and methods you need as a developer, Now, as a SysAdmin, I have a not-so-new word for you, JavaScript. I know most people think this is just for web sites, but it actually goes further. M$ is using javascript as a scripting language that is replacing batch files, and they are using it in OO style. Give it a thought, using JS in that manner can be more challenging. Whatever you choose, have fun with it. If you don't have fun, you won't like it. Don WHITEPAGES.COM | INC Everything I've learned in life can be summed up in a small perl script! | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by Anonymous Monk on Aug 12, 2005 at 16:05 UTC | |
| [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by EvanK (Chaplain) on Aug 12, 2005 at 15:26 UTC | |
addendum: though you can do just about anything in perl, sometimes perl isnt the best way. for instance, if you're aiming for fast, small, standalone executables, C would be the way to go. if you're looking for cross-platform with minimal porting, Java. it's not always "you can do that in perl", sometimes its "you can do that more efficiently in ******* language". __________ | [reply] [Watch: Dir/Any] |
by chromatic (Archbishop) on Aug 12, 2005 at 17:08 UTC | |
if you're looking for cross-platform with minimal porting, Java. It's not my experience that Java is more portable and requires less porting work than Perl. | [reply] [Watch: Dir/Any] |
by EvanK (Chaplain) on Aug 12, 2005 at 17:25 UTC | |
__________ | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by b10m (Vicar) on Aug 12, 2005 at 21:00 UTC | |
As for your professional use (sysadmin), just study the heck out of 'bash', I find new uses for it on almost a daily base (and also daily forget about it's substitute syntax as ${FOO//bar/baz/} etc.). A lot of people think bash is just for looping some GNU tools together. It is more powerful than that ... but then again, you're a sysadmin, so you probably already can dream the manual pages ;) Substitute 'bash' with your favorite shell in this post | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by Dinosaur (Beadle) on Aug 12, 2005 at 20:15 UTC | |
OK: Java! Java!. But here's why I think so. Perl is just plain *wonderful* -- up to a point. It lets you do some pretty sizable jobs with incredible ease. But there comes a point where the job gets bigger than perl (or any other scripting language) can handle. For big jobs, where you'll probably find yourself collaborating with other developers, you need an industrial-strength language. Funnily enough, it's just about at the point where perl collapses under its own weight that OO techniques become useful. This is also the point where a bit more design thought before you code starts to pay off. (Sorry, much as I love perl, I don't consider its OO support one of its strong points). Lots of languages inhabit the space that lies beyond above scripting languages, and I'm not familiar with most of them. But I like Java. IMHO, it has got OO just about right: not as kludgy as C++, but usable to do real stuff, unlike more academic offerings like Eiffel. Java's not as facile to code in as perl (no surprises there). But that's where tools come in. To program in an IDE like Eclipse is a completely different experience. A lot of the heavy lifting is done for you. Eventually, you may find design tools, such as one of the numerous UML packages, useful for doing really big jobs. Go down this route and, as an earlier Anonymous poster suggested, you will "learn about the essentials of computer science which will make you a better programmer". In the process, you may find your way to a few things that are more enjoyable (and remunerative) than Sysadmin jobs. But you'll still find that, for the small things that need doing every day, there's nothing like perl. -- Dinosaur | [reply] [Watch: Dir/Any] |
by adrianh (Chancellor) on Aug 13, 2005 at 08:49 UTC | |
Funnily enough, it's just about at the point where perl collapses under its own weight that OO techniques become useful. This is also the point where a bit more design thought before you code starts to pay off. Curiously enough I find languages like Ruby and Perl more effective at producing larger applications than Java. Seems I'm not alone in this. Not that this is an argument against learning Java. Learning more languages is always a good thing. | [reply] [Watch: Dir/Any] |
by Joost (Canon) on Aug 13, 2005 at 09:56 UTC | |
Curiously enough I find languages like Ruby and Perl more effective at producing larger applications than Java. I find that large(ish) applications in Perl tend to be a lot smaller / simpler than more-or-less equivalent applications in Java (measured in lines of code / number of objects/classes involved etc). Which in turn makes the program easier to understand and maintainable (and quite often faster) than the Java equivalent. Partly this is because of the usefulness of perl's built-ins; arrays and hashes, which means you hardly ever deal with hand-coded "Value-Objects" (i.e. structs, listsOfMyObjects etc), the extremely compact and useful text-processing functions and simple conversion of numbers and strings (which help a *lot* when you're dealing with a large user-interface and is a royal pain in Java). I'm sure another part is due to differences in programmer experience / skill and because the Java projects tend to have more programmers working at them than the perl projects. A project with many programmers of different skill-levels makes for more overhead, more explicit (and complicated) interface specs and many, many more class diagrams :-) (see mythical man-month; basically I'm claiming that not only does a project take more MM if you add programmers, the design also tends to be much more complex than necessary if you don't keep it under tight control). This has probably has little to do with the languages themselves, it's just the specific projects I've worked on, but see below. One of the much-touted advantages of Java is that it enables explicit interfaces, class-contracts and large object-oriented design. Unfortunately (IMO) it also *encourages* large multi-layered designs and complex class-contracts / interfaces where they're inappropriate or even counter-productive. In this respect, Perl is the anti-Java: it encourages compact, implicit code and has *no* explicit class-contracts by default. This can result in programs that basically have "no" design and are completely unmaintainable, but it also means an experienced programmer has a lot more choice on what parts of the pogram are "worth" spending a lot of design time on (which, I think, is why many CPAN libraries have much simpler APIs than their Java counterparts). Basically, in Perl you design because you need to manage complexity, in Java you design *everything* because you just "have to". Personally, I know which of the two approaches I like best :-)
| [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by SolidState (Scribe) on Aug 12, 2005 at 18:56 UTC | |
As you move on from simple system-administration related tasks, you'll find that there is at least one area where Perl does not, alas, excel at - building GUIs Now of course I'm only talking for myself here, other people will probably disagree, but I've seen very few mature, widely used and popular GUI based apps in Perl. I've tried the Perl GTK and QT bindings (too complex, under-documented) and Perl/Tk (simple but plain ugly). After those attempts, I began to understand why I could find few succesful GUI projects in Perl... So if you're interested in trying your hand at GUI building, what should you use? Well, having never tried other languages myself I cannot recommended anything from personal experience, but I've heard Java and Python both mentioned as good GUI languages. | [reply] [Watch: Dir/Any] |
Re: Learning ***** as a second language
by fmerges (Chaplain) on Aug 12, 2005 at 22:08 UTC | |
Hi, Second language??? Strange. Perl is good, but taking a look into another programming languages is a _MUST_, I think, not an option... As someone stated, take a look at C is very important Before learning C++ I would learn Python, Is very simple and it has some nice method to do things, like the lambda mentioned before, Python is very easy to read, andunderstand, and well Pythons OO is much more nicier than Perl strange method...
After taking a look at Python I would take a look into C++ and Java. Java is also very easy to understand, some things are not logic, like why the fuck you need to type something like:
Only to see the Hello World printed on STDOUT... On the way, learn UML, can be useful. ;-) Regards,
|fire| at irc.freenode.net
| [reply] [Watch: Dir/Any] [d/l] [select] |
Re: Learning ***** as a second language
by nothingmuch (Priest) on Aug 15, 2005 at 09:53 UTC | |
SICP is fun and interesting. It's not very relevant for system administration, but in my opinion any programmer should be interested in what they have to say.
-nuffin zz zZ Z Z #!perl | [reply] [Watch: Dir/Any] |