Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Unix and Perl

by mikasue (Friar)
on May 30, 2006 at 19:06 UTC ( #552592=perlquestion: print w/replies, xml ) Need Help??

mikasue has asked for the wisdom of the Perl Monks concerning the following question:

How important is a Unix background when someone wants to learn Perl? Is it very necessary or not necessary at all? Thanks!

Replies are listed 'Best First'.
Re: Unix and Perl
by jdporter (Chancellor) on May 30, 2006 at 19:27 UTC

    Well, it certainly isn't necessary.

    The question really should be, "How helpful is it to have a Unix-y background?"

    To that question, I'd reply "Very". But, OTOH, I wouldn't defer learning Perl in order to learn UNIX first.

    We're building the house of the future together.
Re: Unix and Perl
by Cody Pendant (Prior) on May 30, 2006 at 20:56 UTC
    Nobody wants to quote Larry on the subject? Didn't he say "Perl is the Cliffs Notes to Unix"?

    Which kind of implies that, rather than "you have to know Unix if you're learning Perl", something more like "if you learn Perl, you'll be learning a fair amount of Unix whether you know it or not", I guess.



    ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
    =~y~b-v~a-z~s; print
Re: Unix and Perl
by jdtoronto (Prior) on May 30, 2006 at 19:36 UTC
    Once upon a time it was essential. But since the ActiveState distribution for Windows was merged into the main distribution - I sometimes forget where I am! It is entirely possible to become fluent in Perl now with no Unix knowledge at all.

    Unix'y knowledge, however, is useful in its own right! Especailly as so many Perl jobs will require some contact with Unix and web servers.

    jdtoronto

      Then again by becoming fluent in Perl you to some degree pick up *NIX knowledge. Or at least you get some exposure to it.

      Perl internalizes a good bit of "The *NIX Way" to do things (e.g. file and directory handling, large bits of the POSIX API, the socket API) and by learning to use Perl you're going to look at problems through the prism of that philosophy (pardon me while I run my metaphor through this wood chipper over here a couple more times . . .). Granted while lots of Wintendo specific things don't exactly fit into the same conceptual framework (driving stuff through OLE, for instance) or work as well (processes and fork() versus a thread based model) the underlying basics translate fairly well.

      It is entirely possible to become fluent in Perl now with no Unix knowledge at all.

      It was possible before, too.

      Perl is a 99.9% stand-alone language, unlike the bag of shells and various other tools it replaces en masse. Theoretically, one could program in Perl without knowing anything about *X other than how to log in and launch an editor.

      We're building the house of the future together.
Re: Unix and Perl
by ptum (Priest) on May 30, 2006 at 20:08 UTC

    When I first began developing in Perl, I knew only the most rudimentary Unix commands (ls, cd, chmod, etc.). I got by for quite a while using CGI.pm and the DBI with that level of knowledge, largely because Perl can do most of the things that need doing with the operating system (that, and the webserver admins didn't really want me on their box anyway). Over time, though, as mentioned in other responses, I was exposed to various flavors of Unix and remedied that ignorance. In hiring, I would prefer someone who had at least a base level of Unix knowledge over someone who only knew Perl.

    With regard to learning Perl, Unix knowledge is certainly not a prerequisite, although one might find that knowledge in Unix would tend to accelerate the process of learning Perl, and vice-versa.


    No good deed goes unpunished. -- (attributed to) Oscar Wilde
Re: Unix and Perl
by SirBones (Friar) on May 30, 2006 at 20:23 UTC

    I taught a small basic programming course to a group of middle-schoolers (5th to 7th grades) a year or so ago using Perl. Most of them had never even heard of Unix. They did fine with it on strictly Windows boxes.

    OTOH, any language that has built-in functions such as grep, pipe, and tr/// (among others) clearly owes a large part of its gene pool to Unix, and increasing ones knowledge of either only serves to enchance the other. For example, I was "pretty good" with Linux for a while, but learning Perl in the last few years has really increased my feel for what goes on in the seams of the OS, not to mention my facility with certain commands.

    Cheers,
    Ken

    "This bounty hunter is my kind of scum: Fearless and inventive." --J.T. Hutt
Re: Unix and Perl
by gellyfish (Monsignor) on May 30, 2006 at 20:28 UTC

    Whilst I wouldn't say it was a prerequisite at all, because of its Unix heritage understanding something of Unix does help in a number of ways, firstly why some of the builtin functions are named strangely such as unlink and grep is quite obvious to someone who has worked with a Unix-like operating system, but can be opaque to others, and secondly that the Unix toolbox mindset does pervade a lot of the design of Perl and the way that people think about using it, though you find people talking about this less these days as people seem to make large applications and libraries that do more rather than lots of small things that do one thing really well and can be combined with others to perform a more complex task.

    /J\

Re: Unix and Perl
by blue_cowdawg (Monsignor) on May 31, 2006 at 00:52 UTC
        How important is a Unix background when someone wants to learn Perl?

    <rhetorical question>
    How necessariy is it to know how the engine in a car works in order to drive it?
    </rhetorical question>

    When I taught a course in Intermediate Unix for Programmers at a local college in NYC I used Perl as a programming language to demonstrate how certain Unix functions worked and allow the students to programatically manipulate those functions in an interpreted environment rather than teach them C programming.

    As some folks on this thread have already pointed out Perl is portable and runs on many platforms including Windows and therefore is not tied to Unix. A readdir for instance works the aame (more or less) in Windows as it does in Linux for instance. On the Unix platform it just turns out readdir is a standard C library call. (not sure about Windows.. not my thing.)

    So, no, you don't need to know much about Unix of any flavor to use Perl and no it doesn't even help much. More important is to learn general programming methodology and concepts. Knowledge of data structures is a big help but that isn't even 100% necessary. Certainly knowledge of algorithms (sorting, etc.) is a big help. That can make the difference between a fairly good piece of code and rotten code.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: Unix and Perl
by SamCG (Hermit) on May 30, 2006 at 21:57 UTC
    I say it's not necessary.

    I started in Perl without access to any *nix computers. Come to think of it, I don't think I've ever programmed significantly on Unix (apart from sql scripts), though I certainly wouldn't avoid it.

    Am I a Perl Master? No, though I'd like to think I'm somewhere above novice. Most of my work has involved accessing databases, manipulating files, with a bit of ASP perlscript, pulling emails from my accounts and processing them, etc.

    I certainly don't think I won't have a chance to fully learn Perl because of a lack of Unix. Actually, I suspect learning Perl will help me somewhat if and when I do need to use Unix. It would serve as something familiar, at any rate.

    Of course, part of this could be the effect of not knowing what I'm missing. Perl's served my needs quite admirably. :) As for whether you'll be able to find a JOB knowing Perl but not Unix, that's a separate question.


    -----------------
    s''limp';@p=split '!','n!h!p!';s,m,s,;$s=y;$c=slice @p1;so brutally;d;$n=reverse;$c=$s**$#p;print(''.$c^chop($n))while($c/=$#p)>=1;
Re: Unix and Perl
by vhold (Beadle) on May 30, 2006 at 23:57 UTC
    I think it's safe to say that perl was designed with existing Unix C and/or shell programmers in mind and as such is much easier to learn when you have some experience with those things.

    The nice part though, is that because perl makes easy things easy, I think you'll more likely start succeeding immediately with perl as a starting point then the other way around.

    Perhaps the biggest disadvantage to starting with perl and not the roots it was intended to improve upon is that you may not experience the joy that comes with the simple pleasures of doing easy things easily that in C/shell were a total hassle or fraught with peril. It was really quite a revelation for me.
      Just think about the joy you can experience with perl, when all you had before is a windows cmdline.
Re: Unix and Perl
by Marza (Vicar) on May 30, 2006 at 20:56 UTC

    It depends on where you plan to work. If you only have PCs, then you don't have to have to know Unix.

    However, you will probably come across Unix in your career so I would spend some time and get the basics down. It always looks good to say you can deal with multiple platforms.

    I made the mistake of being a specialist once (Tandem) and it made me undesirable at one time.

Re: Unix and Perl
by chargrill (Parson) on May 31, 2006 at 02:58 UTC

    I'd say not necessary at all. Way back when I was learning Perl, I was on a Macintosh Clone running System 7.something or other. Granted, due to participating on a MacPerl mailing list, where it seemed most on the list had unix background, gave me some exposure to unix-y things. And I think I shortly thereafter started learning Linux, which was helped by having some exposure to it through (strangely enough) MacPerl.

    Would it have been helpful to have unix under my belt first? Perhaps. But I think I managed to get along fine without it, as I'm sure many others have as well.



    --chargrill
    $,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}
Re: Unix and Perl
by CountZero (Bishop) on May 31, 2006 at 06:23 UTC
    I learned Perl 4 on an Atari ST and Perl 5 on a Windows PC, all without having seen or touched a Unix machine. Now that I have a Linux server amongst the computers in my network, I can't say that knowing (some) Unix/Linux helps me in any way to better understand Perl. I feel it is rather the other way around: knowing Perl helped me to get into *nix spirit of things.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Unix and Perl
by Anonymous Monk on May 30, 2006 at 21:38 UTC

    probably less than before: in the 5.8 series some special effort was put to make (part of) the docs less unix-centric

    still, unix is good to know:

  • especially if you plan to use LAMP (it's the combination of tools on unix/linux that sometimes shines)
  • some features of perl are easier to understand/appreciate from a unix perspective
Re: Unix and Perl
by webchalkboard (Scribe) on May 31, 2006 at 11:39 UTC

    Well I don't think its essential, but its certainly very useful and it gives you an understanding of where its all coming from and helps you get in the mindset of the people behind it, and the many cpan modules out there you can install.

    I have played around on Unix and Windows Perl, but started on Unix and I think it definately helped my understanding of the principles involved.

    Learning without thought is labor lost; thought without learning is perilous. - Confucius
Re: Unix and Perl
by Herkum (Parson) on May 31, 2006 at 12:42 UTC

    Without retreading what other people have posted, I will comment on Perl coming from a Windows background.

    When I started with Perl, I was trying to do account manipulation and managing file and directory structures. Most of the functions built into Perl were designed with a *NIX system in mind (for example permissions). In addition, the way permissions worked in WinNT were also more complicated than the standard *NIX version which ended up as a handicap; I had to depend upon the basic WinNT command line utilities; That said those utilities were pretty horrible to learn and use.

    So one of the things that I learned Perl was focused upon *NIX systems when doing administration.

    It also pointed out to me that Windows had serious limitations of its own. There were few toolkits that effectively dealt with administration and those that did were poor. I moved from thinking alot of problems I encountered with Windows were because of my ignorance to Windows was just a plain mess.

Re: Unix and Perl
by rvosa (Curate) on May 31, 2006 at 19:36 UTC
    It helps, though I personally do most of my work on windows and that works just fine. Having some background in unix helps you get your head around the more historical "sysadmin" kind of functions (mkdir, chmod) but you'll pick them up regardless.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://552592]
Approved by itub
Front-paged by xorl
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-05-28 22:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?