Perl question

Sharky Forums


Results 1 to 6 of 6

Thread: Perl question

  1. #1
    Expensive Sushi
    Join Date
    Sep 2000
    Location
    Edmonton,Alberta,Canada
    Posts
    39

    Post Perl question

    So what is an anonymous array? How is it different than a normal array and why would I want to use it?

    I'm having some difficulty with this part of perl....

    ------------------
    on email puppy machine. Pity me.

    dreamin of buildin a new one September 1, 2001.
    NO MORE EMAIL PUPPY MACHINE
    ----
    AMD Athlon XP 2500+ Barton
    w/ Volcano 9 (aptly named, at full power it sounds like a volcano erupting)

    MSI K7N2 delta-L
    768 pc2700 ram (samsung)
    120 gig HD - Seagate
    Sony 52x
    Liteon 48x28x48 cdrw 16x dvd
    Antec Case w/ Antec Truepower 420w
    ATI Radeon 9600 PRO 128meg

  2. #2
    Hammerhead Shark
    Join Date
    Sep 2000
    Location
    Montgomery, AL
    Posts
    1,879

    Post

    Anonymous arrays are non-indexed. In a normal array, each cell is given a name or number, but in an anonymous array, it is not. They are treated only as a whole, and can't be separated and treated as parts.

    ------------------
    Despite the high cost of living, it remains popular.

    [This message has been edited by Sketch (edited January 17, 2001).]
    Insert witty signature here

  3. #3
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    I was actually astonished that you could make anonymous arrays like that. Perl is a VERY forgiving language it seems. There's only 2 data types, and you don't have to initialize any variables. Jeeeez, makes for a nice and easy web language, thats for sure.

  4. #4
    Hammerhead Shark
    Join Date
    Sep 2000
    Location
    Montgomery, AL
    Posts
    1,879

    Post

    I agree. I program in Perl professionally and have developed a love/hate relationship with its lax handling of varaiables. I don't know if you've ever worked with PHP or not, but it is even worse. There is only one (that's right one) data type and the language adjusts its actual type based on usage. Perl does something similar but not to the same extent.

    The laxness of it makes it (Perl) an easy language to program in and to learn, but I have to *strongly* discourage anyone from taking it up as their first programming language. It doesn't reinforce good programming practices, and is in fact very detrimental. Anyone who learns it as a first language is going to struggle later on as they tackle more strongly typed (or even at all typed) languages like C++, Ada, and Java.

    ------------------
    Despite the high cost of living, it remains popular.
    Insert witty signature here

  5. #5
    Expensive Sushi
    Join Date
    Sep 2000
    Location
    Edmonton,Alberta,Canada
    Posts
    39

    Post

    Well PERL isn't my first language I've worked with, I took the old first semester of PASCAL back in my first year of college but it's been a while and I was never top o da class. I"ve also just worked with Javascript. Currently we are taking a course in PHP/ASP and then taking JAVA next month. I'm not to bad at perl, but the anon array thing is kinda nutso. oh well shebang! for everyone

    ------------------
    on email puppy machine. Pity me.

    dreamin of buildin a new one September 1, 2001.
    NO MORE EMAIL PUPPY MACHINE
    ----
    AMD Athlon XP 2500+ Barton
    w/ Volcano 9 (aptly named, at full power it sounds like a volcano erupting)

    MSI K7N2 delta-L
    768 pc2700 ram (samsung)
    120 gig HD - Seagate
    Sony 52x
    Liteon 48x28x48 cdrw 16x dvd
    Antec Case w/ Antec Truepower 420w
    ATI Radeon 9600 PRO 128meg

  6. #6
    Ursus Arctos Moderatis Grizzly's Avatar
    Join Date
    Sep 2000
    Location
    Providence, RI USA
    Posts
    3,077

    Post

    Originally posted by Sketch:
    I don't know if you've ever worked with PHP or not, but it is even worse
    You bet it is. Heh, I was honestly amazed...almost offended at how simplfied these languages are. It just goes to show that there's a fine line between a programming language, and a "scripting" language.

Posting Permissions

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