[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Perl

> I stopped liking perl when I learned why this script didn't do what I
> expected it to do:

Don't expect too much. Every computer system/os/language has their own
strange things/visions/words that does not mean what you expect them to.

> #!/usr/bin/perl -w
> my @array = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
> print length(@array), "\n";

$ man perlfunc | grep -A5 'length EXPR'
       length EXPR
       length  Returns the length in characters of the value of EXPR.
               If EXPR is omitted, returns length of $_.  Note that
               this cannot be used on an entire array or hash to find
               out how many elements these have.  For that, use
               "scalar @array" and "scalar keys %hash" respectively.

> Maybe things have changed since then, but I spent way too much time
> being confused by this.

Badly spent time, check the man page.


If you don't like perl/scheme/pythonn/ruby/c/whatever ---
don't use it, but stop complaining about it.

/Karl Hammar

Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
+46 173 140 57

geda-user mailing list