Hello everyone, I have a snippet of code I would like to ask questions about. I am a newbie so I won't even raise your brainwave level far above a coma. I did this little bit of code to check the contents of a file for any strange characters. The file was causing a freeze and I thought there may be something odd in it. It turned out there wasn't but I have some questions about it. open(SOURCE, '<Robert:Desktop Folder:Addresses') or die; open(DEST, '>Robert:Desktop Folder:Addresses.clean') or die; 1) Does the open command always read the whole file in. This is an interesting syntax because what this did was to put the whole contents of a file line by line into an array. What if my text were very long paragraphs and exceeded the maximum character limit of the variable for each element? @line = <SOURCE>; 2) Why do I need to chomp. The program ran fine and put everything aout like it was suppose to. I believe this is for stripping the CRs at the end of the line? #chomp($line); print "@line\n"; foreach $line (@line) { ($Name, $Phone, $Address, $Type) = split(/\t/, $line); # This cool. I would use this before I would allow the split to assign each line # to different elements in the array. In the importation of records, this seems to be the best way to write to arrays in row/column fashion. 3) Here I didn't have to use the angle brackets around the filehandle. If I did it seemed to refer to the whole file. Without them, it allows whatever you want to put out. As in this case I was able to put out a whole line at a time. print DEST $line; print("The name is $Name.\n"); # This is where I convert each character to the ascii representation. print("The ascii representation is:\n"); for ($i=1;$i <= length($line);$i++) { $num = ord(substr($line, $i, 1)); print("$num,"); if ($num > 127) { print ("\n\nW A R N I N I N G -- ASCII value exceeds 127\n\n"); } } print("\n"); } close(SOURCE); close(DEST); 4) Could you guys give me any tips/hints on code optimization? Thanks for taking time. Robert Pollard ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org