Good Starter Language? (was Re: REALBasic and OpenAL)
Frank Wiles
frank at wiles.org
Fri Apr 1 08:50:05 CST 2005
On Thu, 31 Mar 2005 15:09:46 -0600
"Jeremy Fowler" <JFowler at westrope.com> wrote:
> Perl? Might as well be writing code in Mandarin Chinese. The multitude
> of symbols and one character keywords sacrifices legibility for less
> typing. Perl is not for the faint of heart or the beginner. I for one
> hate having to keep a whole library of O'Reilly books by my side while
> I code. A good language should be intuitive and not require a ton of
> syntax memorization. Python is better, but not by much.
You do know that you can write easily readable Perl don't you? Just
because those weird variables like $_, $', $*, $/, etc exist doesn't
mean you have to use them. In fact they already have built in
"english" equivalents.
I've always seen Perl's ability to do this much like Unix. It gives
you enough rope to hang yourself with, it's your choice whether or
not to use that rope. ;)
Anyone who uses the shortcuts does so knowing they are sacrificing
readability and maintainability. This, as I've said one more
occasions than most people probably want to hear, is the fault
of the programmer not the language.
While you can write:
open(IN, $ARGV[0]);
while(<IN>) { chomp; $_ =~ s/A/B/oig; print; print "\n"; } close;
You can also write:
my $filename = $ARGV[0];
open(IN, $filename) or die "Cannot open input file '$filename': $!\n";
while( my $line = <IN> ) {
chomp($line);
$line =~ s/A/B/oig; # Replace all As with Bs
print "$line\n";
}
close(IN);
---------------------------------
Frank Wiles <frank at wiles.org>
http://www.wiles.org
---------------------------------
More information about the Kclug
mailing list