in reply to Re^4: Perl vs C
in thread Perl vs C
Ok some examples:
in Perl:
In Perl, the list "knows" how big it is.#!usr/bin/perl -w use warnings; my @list = ("a1", "b23", "c45", "d1"); print join (" ",@list),"\n"; #prints: a1 b23 c45 d1
For me, the difference is obvious! The Perl version is cool!include <stdio.h> int main () { char *list[] = {"a1", "b23", "c45", "d1",'\0'}; // list is an array of pointers to chars char **mover; for (mover=list; *mover ;mover++) printf ("%s ",*mover); printf("\n"); } // prints: a1 b23 c45 d1
Perl lists may be changed at will just like in C. I don't understand this comment: "lists are unmutable". Please explain, I just don't understand what you mean.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Perl vs C
by JavaFan (Canon) on Mar 16, 2009 at 14:07 UTC | |
by Marshall (Canon) on Mar 16, 2009 at 14:15 UTC | |
by JavaFan (Canon) on Mar 16, 2009 at 14:23 UTC | |
by Marshall (Canon) on Mar 16, 2009 at 15:00 UTC | |
by ikegami (Patriarch) on Mar 16, 2009 at 15:34 UTC | |
| |
by chromatic (Archbishop) on Mar 16, 2009 at 18:13 UTC |