Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Learning Perl.

  1. #1

    Learning Perl.

    Yep, I finally got bored enough to sit down and learn perl!

    Here's a simple perl implementation of the "echo" command:

    Code:
    #!/usr/bin/env perl
    
    print "@ARGV\n";
    Ain't perl great?

  2. #2

    Re: Learning Perl.

    nice .. and so simple

  3. #3
    Guest

    Re: Learning Perl.

    Code:
    #!/usr/bin/env ruby 
    p ARGV
    Code:
    #!/usr/bin/env python
    
    from sys import argv
    print argv

  4. #4

    Re: Learning Perl.

    sorry, but as far as i'm concerned,

    python > perl ;D

  5. #5
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re: Learning Perl.

    eh

  6. #6

    Re: Learning Perl.

    sorry, but as far as i'm concerned,

    python > perl ;D
    Ugh, I don't like python much anymore.

    Code:
    ...
         return 0
       return 1
    ...
    As far as I'm concerned, any language where something like the above is legal is really messed up. Real languages use braces to denote code blocks, not indentation. Makes them so much easier to read.

  7. #7
    Guest

    Re: Learning Perl.

    #:: ::-| ::-| .-. :||-:: 0-| .-| ::||-| .:|-. :||
    open(Q,$0);while(<Q&gt{if(/^#(.*)$/){for(split('-',$1)){$q=0;for(split){s/\|
    /:.:/xg;s/:/../g;$Q=$_?length:$_;$q+=$q?$Q:$Q*20;}print chr($q);}}}print"\n";
    #.: ::||-| .||-| :|||-| ::||-| ||-:: :|||-| .:|

    As far as I'm concerned, any language where something like the above is legal is really messed up. Real languages use indentation to denote code blocks, not braces. Makes them so much easier to read.

  8. #8
    Associate
    Join Date
    May 2001
    Posts
    19

    Re: Learning Perl.






    As far as I'm concerned, any language where something like the above is legal is really messed up. Real languages use braces to denote code blocks, not indentation. Makes them so much easier to read.
    I'm sorry, but having heard you say that, all your opinions are suspect, IMO. Perl, in general, has never been more readable than python (again, IMO obviously), even when a user doesn't use context to obfuscate the code. Having used python for the last six or so months, I have to say that not having braces makes code (to me) worlds easier to read. Indentation is used for readability. Braces are used to tell the compiler when a block is done. Makes sense to combine them and get rid of those extraneous characters. IMO, a language that doesn't need extra characters scattered about (including the $,@,%) is more aesthetically pleasing, more readable, and more writable. But if you think that, it's your opionion, and I won't try to change it; I'll just have to remember not to base my judgements on your opinions.

    I don't mean to be insulting; I just want you to understand how vehemently I disagree with you. And I wonder just how much you've used python.

  9. #9

    Re: Learning Perl.

    #:: ::-| ::-| .-. :||-:: 0-| .-| ::||-| .:|-. :||
    Wow, talk about a slanted opinion. That's a freaking comment! That has nothing to do with anything! You just put that there to look worse than it really is!

    open(Q,$0);while(<Q&gt{if(/^#(.*)$/){for(split('-',$1)){$q=0;for(split){s/\|
    /:.:/xg;s/:/../g;$Q=$_?length:$_;$q+=$q?$Q:$Q*20;}print chr($q);}}}print"\n";
    Only an idiot would code something like that (how surprizing that it comes from you...). A sane person would have written it like this:

    Code:
    open(Q,$0);
    while(<Q>)
    {
     if(/^#(.*)$/)
     {
      for(split('-',$1))
      {
       $q=0;
       for(split)
       {
        s/\|/:.:/xg;
        s/:/../g;
        $Q=$_?length:$_;
        $q+=$q?$Q:$Q*20;
       }
       print chr($q);
      }
     }
    }
    print "\n";
    As far as I'm concerned, any language where something like the above is legal is really messed up. Real languages use indentation to denote code blocks, not braces. Makes them so much easier to read.
    Way to completely miss the point Vince!

  10. #10

    Re: Learning Perl.

    Perl, in general, has never been more readable than python (again, IMO obviously), even when a user doesn't use context to obfuscate the code.
    My point was that it's really confusing to see a return statement on one line, then another one on the next line! Logically, you'd think the next one does nothing, because the first one already returns something and ends the function/whatever the code block was.

    Indentation is used for readability.
    I agree that indenting it properly makes it easier to read (stupid vince), but once you lose the braces, the code blocks become blurred and harder to see just by looking.

    IMO, a language that doesn't need extra characters scattered about (including the $,@,%) is more aesthetically pleasing, more readable, and more writable.
    Well first of all, one thing that really bothers me about python is that it doesn't even convert between the different types of variables automatically. I mean, python will tell you plain and simple that 1/2=0, but 1.0/2=0.5. Awesome language, guys! In perl, if you divide two numbers, it gives you the actual value, not rounded down or whatever.

    On top of that, perl will tell you just by looking at the name of a variable whether you are dealing with a scalar, array or hash. Python won't tell you anything about a variable by it's name -- and python has so many more types of variables! ints, floats, lists, strings, etc. Way more confusing if you ask me.

    I'll just have to remember not to base my judgements on your opinions.
    When have you ever based your judgements on my opinions?

    And I wonder just how much you've used python.
    Well, I've submitted more Python examples to CCAE than perl examples.

Similar Threads

  1. learning linux
    By egoadk in forum Windows - General Topics
    Replies: 2
    Last Post: 02-25-2003, 09:01 PM
  2. Learning programming
    By trickster in forum Programming
    Replies: 2
    Last Post: 09-19-2002, 10:40 AM
  3. Scheme Learning and Q&A, #1
    By ndogg in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 04-12-2002, 05:00 PM
  4. Learning php
    By Vagrant in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 03-20-2002, 12:46 AM
  5. learning php
    By philosophia in forum Linux - Software, Applications & Programming
    Replies: 9
    Last Post: 03-01-2002, 08:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •