🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #4351

Re: Readable Perl (was: Re: Relative Speed of Perl vs. Tcl vs. C)

#4351
From: Kazimir Kylheku
Date: Thu, 15 Feb 1996 22:58
63 lines
1910 bytes
In article <ukd97hwzkc.fsf_-_@linda.teleport.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "John" == John Viega <jtv2j@mamba.cs.virginia.edu> writes:
>
>John> People bitch about the readability of Perl non-stop.  In fact, I have
>John> heard the joke, "Perl, the only language you can uuencode, and not
>John> notice" twice this week around the department.
>
>OK, now which do you find most readable...
>
>	$i = 1;
>	while ($i <= 10) {
>		print "I can count to $i\n";
>		$i++;
>	}
>
>	for ($i = 1; $i <= 10; $i++) {
>		print "I can count to $i\n";
>	}
>
>	foreach $i (1..10) {
>		print "I can count to $i\n";
>	}
>
>	$i = 0;
>	print "I can count to $i\n" while ++$i <= 10;
>
>	print map "I can count to $_\n", 1..10;
>
>	50 FOR I = 1 TO 10
>	60 PRINT "I CAN COUNT TO ",I
>	70 NEXT I

None of the above, bud.

I find this readable

	for x in 1 2 3 4 5 6 7 8 9 10 ; do
		echo "I can count to" $x
	done

followed by, in second place:

	x=1
	while [ ! "$x" = "11" ] ; do
		echo "I can count to" $x
		: $(( x += 1 ))
	done

...and third place:

	...
	movl	$1, %edx
loop:	pushl	%edx
	movl	$message, %eax
	pushl	%eax
	call	_printf
	inc	%edx
	cmpl	$10, %edx
	jae	loop
	...
message	.ascii	"I can count to %d\n\0"
-- 
Technical Details
Message-ID: <4g0drdINN167@keats.ugrad.cs.ubc.ca>
Path: arc1-ca.pugleaf.net!keats.ugrad.cs.ubc.ca!not-for-mail
References: <4e3a2u$eoa@wcap.centerline.com> <4fncgf$96e@solutions.solon.com> <JTV2J.96Feb12142743@mamba.cs.virginia.edu> <ukd97hwzkc.fsf_-_@linda.teleport.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!keats.ugrad.cs.ubc.ca!not-for-mail
From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
Newsgroups: comp.lang.misc,comp.lang.perl.misc,comp.lang.tcl,comp.lang.c,comp.lang.java
Subject: Re: Readable Perl (was: Re: Relative Speed of Perl vs. Tcl vs. C)
Date: 15 Feb 1996 14:58:53 -0800
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Message-ID: <4g0drdINN167@keats.ugrad.cs.ubc.ca>
References: <4e3a2u$eoa@wcap.centerline.com> <4fncgf$96e@solutions.solon.com> <JTV2J.96Feb12142743@mamba.cs.virginia.edu> <ukd97hwzkc.fsf_-_@linda.teleport.com>
NNTP-Posting-Host: keats.ugrad.cs.ubc.ca