[Tutor] Are you allowed to shoot camels? [kinda OT]

Max Noel maxnoel_fr at yahoo.fr
Thu Feb 3 00:33:44 CET 2005


On Feb 2, 2005, at 23:18, Liam Clarke wrote:

> 1) I'll use Perl for the regex stuff from now on, Perl is obviously
> built for this.

	Actually IIRC Perl *invented* regexes as we know them. The "standard" 
regex syntax is known as "Perl regex syntax".

> 2 ) There's More Than One Way To Do It makes debugging hard - i.e.
> close INFILE; & close (INFILE); are both valid. I like one syntax, cos
> it's easier to remember.

	I don't find it that bad. Ruby does it as well, and it's perfectly 
readable. It's more or less equivalent as if condition: and 
if(condition): both being valid in Python.

> 3) Some stuff is counter-intuitive -
> $lenOfModList = @moddirList is the Perl equivalent of lenofModList =
> len(moddirList)

	You sure of that? I was under the impression that len(moddirList) in 
Perl was $moddirList (@moddirList is the list itself).

> Also, why doesn't if ( not $d eq "a" && not $d eq "c") evaluate to
> true for $d = "b" when
> if (not $d eq "a") evals to true and if ($d ne "a" && $d ne "c") evals
> true also? What's with that?

	This probably has to do with operator precedence. It's been lifted 
from C, so chances are that && has a higher precedence than eq. Use 
parentheses.

> 4) WHAT IS WITH THE STUPID SYMBOLS EVERYWHERE LARRY??!!
>
> I'm not referring to the $ & @, I can see how they could be useful,
> although with a list -
>
> @dude = (1, 2, 3), to obtain the 2nd value I would expect $d = 
> @dude[1],
> not $d  = $dude[1], that's counterintuitive also.

	This will be fixed in Perl 6. Then again, Perl 6 is supposed to be 
pure heaven, as the Parrot virtual machine can theoretically be used 
with any language and is heavily optimized. Python and Ruby with the 
speed of Perl, and the possibility to interface your code with CPAN 
modules. That's really cool.
	Once Perl 6 is released, of course.

> Why is the read/write modifier part of the filename??? Why is it a > ?
> In my opinion, there's only one place a > sign should be, in an
> inequality test.

	This is consistent with UNIX redirection. ./foo > bar.txt executes the 
command foo, and redirects its STDOUT to the file bar.txt. ./foo >> 
bar.txt does the same, but appends to bar.txt instead f overwriting it.

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"



More information about the Tutor mailing list