in reply to Re: TIMTOWTDI Challenge: Open a file
in thread TIMTOWTDI Challenge: Open a file

Well, I agree that though there are many ways to do things, there are occasionally only a few (or a single) good way(s) to do it. And on the face of things, it would seem obvious that when you want to open a file, you just open it.

I wouldn't want to advocate difficult to read code, and as I mentioned in my own earlier post in this thread, this really is just for fun. But the mental exercise is valuable, I believe. There is nothing wrong with exploring the corners of the language, as long as you take the time to learn why, and why not. A great orator may command a mastery of spoken language that would make doctors and attorneys blush. And certanly he may go to great lengths to personally explore the corners of his language of communication. But in composing a speech, he is going to select words and constructs from his tool chest of expression that meet the needs of his audience, in level of education, field of specialty, as well as degree of entertainment, appropriate level of formality, and efficiency of communication of important ideas.

In coding, there are many such factors to keep in mind. Maintainability (usually but not always an issue), corporate culture for coding style (sometimes, sometimes not an issue), conciseness, efficiency, and so on. The truth is, there may even be an appropriate time to unshift a filename into @ARGV and tap into the diamond operator's power. That's not usually the clearest way to open and read a file. But nobody should go so far as to say it's never appropriate.

...just some food for thought. Now back to the fun at hand.......


Dave