Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Perl influences?

by gam3 (Curate)
on May 05, 2005 at 19:23 UTC ( #454476=note: print w/replies, xml ) Need Help??

in reply to Perl influences?

I think that there was some lisp influences as well.

I don't see much sh influence though.

Update: I see the influences now.

-- gam3
A picture is worth a thousand words, but takes 200K.

Replies are listed 'Best First'.
Re^2: Perl influences?
by hardburn (Abbot) on May 05, 2005 at 20:04 UTC

    Some of the file-checking operations (-f, -d, etc.) are taken directly from sh.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Re^2: Perl influences?
by Roy Johnson (Monsignor) on May 05, 2005 at 20:08 UTC
    The directional operators to open, and the file test operators come from sh. As does file globbing.

    Caution: Contents may have been coded under pressure.

      More stuff derived from sh:

      • # as comment character.
      • Here-docs (perl's being much more powerful).
      • Capturing command stdout with backticks, i.e. `$cmd`.
      • "$var" interpolates $var, while '$var' does not.
      • Built-in vars: $? status of last command; $$ pid; $0 program name.
      • Having separate "string" versus "numeric" operators, albeit with different names; for example, shell uses = for string equality, -eq for numeric, while perl is more logical (string variants alphabetic), == for numeric, eq for string.
      • && and || operators (ok, C has these too).
      • the tr function seems inspired by Unix tr command, with y synonym to appease sed fanatics (modern day golfers being grateful for said sed fanatics early influence:-).
      • Many other perl internal functions seem inspired from sh or Unix commands, for example: shift, chown, chmod, mkdir, eval, exit, kill, sleep, umask.

Re^2: Perl influences?
by merlyn (Sage) on May 06, 2005 at 11:13 UTC
    A few other sh influences (sorry if this duplicates a few others... I merely skimmed):
    • The fact that it's a "script": there's no "main" function that has to be declared and executed first
    • The type of a variable is implicit in the variable name
    • The quoting style for "this${var}that" (putting curlies around name as a delimiter when adjacent to more word chars"

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      Interestingly, we are "unborrowing" that last one in Perl 6, since you can just interpolate a closure instead: "this{$var}that", and curlies were too heavily overloaded in Perl 1..5.

      But as to the original question, these days it might be easier to list the languages that Perl doesn't borrow something from... :-)

Re^2: Perl influences?
by doom (Deacon) on May 06, 2005 at 00:59 UTC
    I think that there was some lisp influences as well.
    Notably, "map".

      I was under the impression that eval was one of the most lispish feature of perl.

      "Most self-respecting scripting languages such as BASIC (some versions, anyway), Perl, Tcl, LISP, and Python have a feature that clearly sets them apart from systems programming languages like C: the ability to treat character strings as little programs."

      Advanced perl programming, chapter 5"

Re^2: Perl influences?
by blazar (Canon) on May 06, 2005 at 07:52 UTC
    I don't see much sh influence though.
    I can see many, though, and in addition to those pointed out by others it seems to me that sigils, which are by now so charachteristic (also) of Perl, have not been mentioned yet. But maybe they're inherited from something else - I'm not a language historian after all... oh and while we're at it, maybe it's worth reminding that their syntax is somewhat different in sh's, as they (limitedly) declinate there, as they do in tcl (IIRC).

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://454476]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (None)
    As of 2021-10-16 16:18 GMT
    Find Nodes?
      Voting Booth?
      My first memorable Perl project was:

      Results (69 votes). Check out past polls.