Nicely explained Paul. :-)) Cheers,
Rob ----- Original Message ----- From: "Paul Johnson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, December 03, 2002 11:26 AM Subject: Re: $_ @_ and others > > Well, it's true, Perl gives you more than enough rope with which to hang > yourself. But sometimes you need that rope, and if you didn't have it > you'd have to jump through hoops instead and might end up painting > yourself into a corner. > > It's fairly easy to write ugly programs in Perl, if thats what you want to > do. It's also fairly easy to write ugly programs in other languages, if > thats what you want to do. > > But on the plus side, it's also fairly easy to write extremely elegant > programs in Perl, and that's not always true about other languages. > > One way in which Perl is different from most other langauges is that it > allows you to program in a number of styles - and there is no officially > correct style to use. In fact, it may be appropriate to use different > styles at different times and for different purposes. > > For example, you might program "quick and dirty" for a 10 line script you > think you'll only use once or twice. You might decide to use a style that > is fundamentally imperative, or objective, or functional. Or you might > mix and match. You might "use English", you might use default values, you > might put parentheseis around all your function calls, you might use lots > of REs, you might use pack, you might drop down to XS for parts of the > program, you might be learning and program "baby Perl", you might use > CPAN, you might reinvent wheels. All of these are OK, and might be > appropriate at different times. > > Perl takes the attitude that you are the programmer, and you should know > how best to solve your problem. You can ask perl for some help, but you > will not be forced into a certain style just because someone thought they > knew better than you. It is up to you to provide the discipline, if that > is what you want. > > With respect to your point about $_. $_ functions like "it" in English. > It saves you from having to continually specify the variable with which > you are working, but yes, you then have to understand the context. This > is one way in which you can write elegant programs, but if your use of $_ > gets too far away from where the topic is set then you get ugly programs. > Again, the programmer must enforce his own discipline. Use it where > appropriate, don't use it where it is not. You get to decide what is > appropriate. > > -- > Paul Johnson - [EMAIL PROTECTED] > http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]