What are the vestiges of Pascal left in Perl?

Discussion in 'Perl Misc' started by Jean-Baptiste Mazon, Apr 19, 2007.

  1. Hi,

    The perl manpage mentions the following:

    Perl combines (in the author's opinion, anyway) some of the
    best features of C, *sed*, *awk*, and *sh*, so people familiar
    with those languages should have little difficulty with it.
    (Language historians will also note some vestiges of *csh*,
    Pascal, and even BASIC-PLUS.)

    I could easily find a few examples of Perl features common with C,
    sed, awk and sh. With a little additional research, I could find
    similarities with csh and BASIC-PLUS, too.

    I'm stuck about Pascal.

    What vestige did the author have in mind?
    Jean-Baptiste Mazon, Apr 19, 2007
    #1
    1. Advertising

  2. Jean-Baptiste Mazon

    Mirco Wahab Guest

    Jean-Baptiste Mazon wrote:
    > I'm stuck about Pascal.
    >
    > What vestige did the author have in mind?


    There are some ideas, like:

    BEGIN
    writeln('Hello, World!')
    ...
    ...
    writeln('By bye world!')
    END.

    evolved to:

    BEGIN {
    print "Hello, World!\n"
    }
    ...
    ...
    END {
    print "By bye world!\n";
    }

    Other points:

    # use 'use vars' because it resembles pascals 'var'
    # Perl # Pascal
    use vars qw'@a1 @a2 @a3';
    @a1 = 1 .. 10; # var a1: 1..10;
    @a2 = 'a'..'z'; # var a2: 'a'..'z';
    @a3 = 'two'..'four'; # var a3: two..four;


    Of course, the latter *would not* do what you'd
    expect from Pascal ;-)


    Regards

    M.
    Mirco Wahab, Apr 19, 2007
    #2
    1. Advertising

  3. Jean-Baptiste Mazon

    Tony Curtis Guest

    Mirco Wahab wrote:
    > Jean-Baptiste Mazon wrote:
    >> I'm stuck about Pascal.
    >>
    >> What vestige did the author have in mind?

    >
    > There are some ideas, like:
    >
    > BEGIN
    > writeln('Hello, World!')
    > ...
    > ...
    > writeln('By bye world!')
    > END.
    >
    > evolved to:
    >
    > BEGIN {
    > print "Hello, World!\n"
    > }
    > ...
    > ...
    > END {
    > print "By bye world!\n";
    > }


    That seems a bit of a stretch to me. The BEGIN and END in perl are
    pattern-based as in awk, not a statement block syntactic container.
    Tony Curtis, Apr 19, 2007
    #3
  4. Mirco Wahab <> writes:
    > Jean-Baptiste Mazon wrote:
    > > I'm stuck about Pascal.
    > > What vestige did the author have in mind?

    >
    > BEGIN {
    > print "Hello, World!\n"
    > }
    > ...
    > ...
    > END {
    > print "By bye world!\n";
    > }


    Those really look more like awk than Pascal to me :)

    > # use 'use vars' because it resembles pascals 'var'
    > # Perl # Pascal
    > use vars qw'@a1 @a2 @a3';


    I don't think both languages calling variables "variables" is going to
    be enough for me to rank it a similarity ;-)

    > @a1 = 1 .. 10; # var a1: 1..10;
    > @a2 = 'a'..'z'; # var a2: 'a'..'z';
    > @a3 = 'two'..'four'; # var a3: two..four;


    The range operator in list context is a very good one! Thanks!
    It sounds pretty much like a conclusive "that's the one!", unless
    someone can dig up another candidate of such fine quality.
    Jean-Baptiste Mazon, Apr 19, 2007
    #4
  5. Jean-Baptiste Mazon

    Guest

    On Apr 19, 12:04 pm, Jean-Baptiste Mazon <>
    wrote:
    > Pascal, and even BASIC-PLUS.)
    >
    > I'm stuck about Pascal.


    Me too. Pascal was my favorite language in college and I knew it
    well. When I picked up Perl, I never once thought, "hey, that's like
    Pascal". There are some conceptual similarities (RECORDs are like
    hashes, etc) and some obvious overlap in keywords and operators, but
    otherwise Perl does not strike me as anything whatsoever like Pascal,
    and I am at a loss to see any vestiges.

    --
    The best way to get a good answer is to ask a good question.
    David Filmer (http://DavidFilmer.com)
    , Apr 19, 2007
    #5
  6. Jean-Baptiste Mazon

    Mirco Wahab Guest

    Abigail wrote:
    > Mirco Wahab () wrote on MMMMCMLXXIX September MCMXCIII
    > in <URL:news:f08g6i$huv$-halle.de>:
    > Perls 'BEGIN' and 'END' come from awk where they perform a similar role
    > as in Perl.
    >
    > Pascals 'BEGIN' and 'END' are Perls '{' and '}'.


    Correct, I was mislead because I considered
    Pascal to be *older* than awk and therefore
    had these keywords earlier.

    But you are right, the meaning of the keywords
    in Perl is somehwow close to awk.

    Thanks & Regards

    Mirco
    Mirco Wahab, Apr 19, 2007
    #6
  7. Jean-Baptiste Mazon

    Mirco Wahab Guest

    Tony Curtis wrote:
    > Mirco Wahab wrote:
    >> BEGIN
    >> writeln('Hello, World!')
    >> ...
    >> ...
    >> writeln('By bye world!')
    >> END.
    >>
    >> evolved to:
    >>
    >> BEGIN {
    >> print "Hello, World!\n"
    >> }
    >> ...
    >> ...
    >> END {
    >> print "By bye world!\n";
    >> }

    >
    > That seems a bit of a stretch to me. The BEGIN and END in perl are
    > pattern-based as in awk, not a statement block syntactic container.


    Yepp, after thinking again, this seems to be nonsense
    from my side. I was mislead by Pascal being the older
    language and containing this keyword pair (which has,
    of course, a completely different meaning there).

    Sorry & thanks

    M.
    Mirco Wahab, Apr 19, 2007
    #7
  8. Jean-Baptiste Mazon

    Mirco Wahab Guest

    Jean-Baptiste Mazon wrote:
    > Mirco Wahab <> writes:
    >> @a1 = 1 .. 10; # var a1: 1..10;
    >> @a2 = 'a'..'z'; # var a2: 'a'..'z';
    >> @a3 = 'two'..'four'; # var a3: two..four;

    >
    > The range operator in list context is a very good one! Thanks!
    > It sounds pretty much like a conclusive "that's the one!", unless
    > someone can dig up another candidate of such fine quality.


    There are, imho, some identical expressions, like:

    length($string); # length(string);
    index($string, 'a'); # index(string, 'a');

    but I'm not-as-sure-as-before if this
    is a qualifying point ;-)

    (could come from BASIC)

    Regards

    M.
    Mirco Wahab, Apr 19, 2007
    #8
  9. Jean-Baptiste Mazon

    Uri Guttman Guest

    >>>>> "MW" == Mirco Wahab <> writes:

    MW> Abigail wrote:
    >> Mirco Wahab () wrote on MMMMCMLXXIX September MCMXCIII
    >> in <URL:news:f08g6i$huv$-halle.de>:
    >> Perls 'BEGIN' and 'END' come from awk where they perform a similar role
    >> as in Perl.
    >> Pascals 'BEGIN' and 'END' are Perls '{' and '}'.


    MW> Correct, I was mislead because I considered
    MW> Pascal to be *older* than awk and therefore
    MW> had these keywords earlier.

    MW> But you are right, the meaning of the keywords
    MW> in Perl is somehwow close to awk.

    well, algol used BEGIN/END and PL/I also used END keywords (actually
    pl/i didn't officially have keywords). most langs (other than lisp and
    fortran which are so early) borrowed/stole ideas from other langs. it is
    hard not to do that as most langs are created by someone using another
    lang and saying, i want it to also do this feature in this way. larry
    did just that as nothing he was using at the time (c, sh, awk) could do
    it all and as easily as he wanted. and perl6 is doing this even more
    deeply by integrating ideas from many many sources as languages have
    evolved greatly since perl was created.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Uri Guttman, Apr 19, 2007
    #9
  10. Jean-Baptiste Mazon

    Mirco Wahab Guest

    Abigail wrote:
    > However, I doubt that Aho, Kerninghan and Weinberger said "Hmmm, we want
    > to be able to define actions at the beginning of processing the input,
    > and at its end. Now, Pascal uses those nifty block delimiters 'BEGIN'
    > and 'END' - let's borrow them!'.


    Thanks, I needed that ;-)

    shonky.com/Pics/larson.jpg

    Regards

    Mirco
    Mirco Wahab, Apr 19, 2007
    #10
  11. Jean-Baptiste Mazon

    Joe Smith Guest

    Jean-Baptiste Mazon wrote:
    > Hi,
    >
    > The perl manpage mentions the following:
    >
    > Perl combines (in the author's opinion, anyway) some of the
    > best features of C, *sed*, *awk*, and *sh*, so people familiar
    > with those languages should have little difficulty with it.
    > (Language historians will also note some vestiges of *csh*,
    > Pascal, and even BASIC-PLUS.)
    >
    > I could easily find a few examples of Perl features common with C,
    > sed, awk and sh. With a little additional research, I could find
    > similarities with csh and BASIC-PLUS, too.


    BASIC-PLUS had a very useful idiom:

    PRINT IF POS(0)

    That says to output CR and LF if the terminal's print head was
    not already at the left margin. I was very glad to see that
    Larry Wall had adopted the

    statement if condition;

    syntax into Perl.

    -Joe
    Joe Smith, Apr 20, 2007
    #11
  12. Jean-Baptiste Mazon

    Bart Lateur Guest

    Jean-Baptiste Mazon wrote:

    >The perl manpage mentions the following:
    >
    > Perl combines (in the author's opinion, anyway) some of the
    > best features of C, *sed*, *awk*, and *sh*, so people familiar
    > with those languages should have little difficulty with it.
    > (Language historians will also note some vestiges of *csh*,
    > Pascal, and even BASIC-PLUS.)
    >
    >I could easily find a few examples of Perl features common with C,
    >sed, awk and sh. With a little additional research, I could find
    >similarities with csh and BASIC-PLUS, too.
    >
    >I'm stuck about Pascal.


    That is odd. I see no mention of Ada. Perl has quite a few things that
    appear to be borrowed from Ada (as does Oracle's stored procedure
    language PL/SQL):

    - "package"
    - "elsif"
    - originally, the package name separator: the apostrophe -- now the
    double colon, but the apostrophe still works: Foo::Bar is the same as
    Foo'Bar
    - underscores as a soft marker in numbers: 10_000 (= 10000)


    --
    Bart.
    Bart Lateur, Apr 21, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adam

    Pascal-style "types"

    Adam, Feb 19, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    334
  2. Ivan Vecerina
    Replies:
    1
    Views:
    1,236
    Jerry Coffin
    Oct 21, 2003
  3. =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=

    Help on table align on left of page vs left hanging indent

    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=, Jul 10, 2007, in forum: XML
    Replies:
    2
    Views:
    985
    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=
    Jul 16, 2007
  4. pc
    Replies:
    2
    Views:
    1,292
    crisgoogle
    Jun 8, 2011
  5. lawrence
    Replies:
    13
    Views:
    285
    Thomas 'PointedEars' Lahn
    Sep 4, 2004
Loading...

Share This Page