On Thu, Jun 24, 1999 at 01:15:01PM -0500, Robert Pollard wrote: > > > > Yes, that is what it is for. If you're not _sure_ what chomp() does, why > > didn't you read the documentation??? > > Because I couldn't get to the documentation to double check what I thought I > had read. I have the book on order for over 2 weeks with no indicator of when > I will see it and the online version wasn't available. I believe the server > was down. I checked this morning and it still wasn't available. I apologize > for not being able to remember things that I glance at, but there is so much > to take in. I'm not sure which book you are referring too. The standard documentation comes with Perl, even MacPerl. You should have all the standard documentation on your hard drive. You can read it with Shuck, which also comes with MacPerl. > > Angle brackets around a filehandle are the _input_ operator. If you're > > trying to output to a filehandle, you should not use the input operator on > > it. Once again, why haven't you read the documentation??? > > I'm sorry but this tidbit didn't jump out at me when I went over the > documentation. I went back and looked for it under "Builtin functions" under > "open" and still didn't see this. Maybe they assume you can figure it out. In this case, you want to look at perlop for the input operator <>, and perlfunc for the print() function. The documentation for print() shows that you call it like print FILEHANDLE, rather than print <FILEHANDLE>. > > Tip #1. Read the documentation. > > I have and am continuing to. You may be one of those genius types that can do > things like look at hexadecimal code and know exactly what it does. Me, it > takes time. Not at all. I'm one of those genius types that reads the documentation. :) > > Tip #2. Try to program in Perl, not in C. The for loop above is how you > > would solve this problem in C. A more Perlish way would be: > > > > foreach (split //, $line) { > > print $num = ord $_; > > I have looked for "$_" throughout the documentation in both the MacPerl: Power > and Ease and in the documentation. I can't find it anywhere. I wish I could > do a keyword search but I can't and it takes time to find these things. In this case, you want to look at perlvar, for documentation on the special variable $_. Another way to write the above would be: foreach $var (split //, $line) { print $num = ord $var; If I leave off $var, then foreach uses $_ as the default variable. Actually, ord() will use $_ as the default variable as well, but I left that on to make it a little more clear. I'm afraid I don't have MacPerl: Power and Ease, so I don't know where in the book $_ is explained. Ronald ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org