Debbie Cooper wrote at Sun, 27 Apr 2003 13:43:05 -0400: > Can you tell me what this line does: > > next if $. == 1 and -s OUT; > > I think I get everything but the "and -s." The -s is a file operator that returns the size of the specified filehandle (or even name). A returned size may have values from 0 to any positive number. If the size of OUT is 0, the condition is regarded as false, otherwise as true. You can read the details with perldoc -f -X > Also, the more I see of the > solutions on this list the more I'm convinced this is not an easy > language to learn. I would say that it is only hard to learn all about Perl. But to learn enough to solve 90% of _all_ your problems quick and efficient is much easier than in most other languages. Perhaps the main reason is that Perl doesn't enforce a special programming paradigm, but enables all in a reasonable fair fashion. So you can program in the style like you are thinking, not how the programming language would want it. > Any suggestions for how to get a grasp of this language? I have two > O'Reilly books, Learning Perl and Programming Perl and I'm slowly going > through the Learning Perl book but it isn't easy. These both books should be enough (even to become a guru). > And I've been > programming for a lot of years! Is there some way to step through the > code to see what it's doing? Read it :-) In fact, good written Perl code is much more English than a programming language (forget about the rest). All you have to do is to retranslate Perlish statements to English sentences. That means replacing $_ with it, map with 'change everything of the list in that way', grep with 'take everything of the list but ...', join with 'join', m/.../ with 'looks like' and so on. > (I lied about two questions) For example, when I program Java, I put in > a lot of System.out.printlns if I want to see what my code is doing (I > don't use an IDE). You can also put a lot print "..."; # or print STDERR "..."; statements in Perl code. (But of course it's harder to see what Perl does from line to line because Perl can do much more in a line than Java or any other language but I wouldn't regard that as a disadvantage IMHO) > Also, is this the right language to do quick text > processing like I've been asking? I get the impression from my reading > that maybe this isn't the correct solution. What do all of you think? Perl is an acronym for Practical Extraction and Reporting Language. So it was primarly constructed for working with textual data. IMHO, it's hard to find a language where are so many high efficient (in lines of code and in speed!) string and file operations are possible. But to say the truth, I missed the beginning of this thread and so I can't answer whether you've chosen the right language for your problem as I don't know what problem was yours :-( Greetings, JanekThread Previous | Thread Next