-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello,
bid> Well, I always had my doubts about Python. Of course, I have done bid> next to nothing with Python and quite some code in Perl, so quite bid> different experiences ;) bid> Of course Perl has other problems like readability of code and bid> soon compatibility problems when they switch from 5 to 6. That's why I prefered python ;-) It's very easy to read and understand: Look here... some thing I found on a website - it is in german but I think it doesn't matter if I do not translate it: Here is the perl way of opening a file, reading it and sorting the lines into a new file: - ---- SNIP ---- #!/usr/bin/perl -w # Dateiname ermitteln $dateiname = shift; # Datei lesen open DATEI, "<$dateiname" or die "$dateiname laesst sich nicht oeffnen\n" @zeilen = <DATEI> or die "$dateiname ist nicht lesbar\n" close DATEI; # sortieren @zeilen = sort @zeilen; $dateiname .= '.sortiert'; # Datei schreiben open DATEI, ">$dateiname" or die "$dateiname laesst sich nicht oeffnen\n" print DATEI @zeilen or die "$dateiname ist nicht schreibbar\n" close DATEI or die "$dateiname ist nicht schreibbar\n" - ---- SNIP ---- And the python way looks like this: - ---- SNIP ---- #!/usr/bin/python import sys # Dateiname ermitteln dateiname = sys.argv[ 1 ] # Datei lesen try: datei = open( dateiname, 'r' ) zeilen = datei.readlines() datei.close() except IOError: print dateiname, "ist nicht lesbar" sys.exit( 1 ) # Datei sortieren zeilen.sort() dateiname = dateiname + '.sortiert' # Datei schreiben try: datei = open( dateiname, 'w' ) datei.writelines( zeilen ) datei.close() except IOError: print dateiname, "ist nicht schreibbar" - ---- SNIP ---- Some other thing is that python knows about classes :-) But I do not want to start a discussion about pro perl or python :-) Cheers, Jan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (MingW32) Comment: Benutzt PGP! Fragen? [EMAIL PROTECTED] iD8DBQE//DtFvvmCkIIgH8QRAu8RAJoCCmI1b7l0I61JhxfITE7fs3UWNwCeKJJD 2VdRCbn8f8ABcuzSewy7L/8= =Mg3n -----END PGP SIGNATURE----- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]