in reply to Re: Can't get the desired output..
in thread Can't get the desired output..

Well said.   One fundamental principle in the Perl community is:   “TMTOWTDI™ = There’s More Than One Way To Do It.”   And there’s a lot more to that notion than first meets the eye.   Perl has many different well-tested tools for tearing strings apart and for representing the data that you’ve ripped out of a text file.   (And a great many other pursuits, as well.)   Every person who has responded and who will respond to the thread is approaching the problem in a different way (making certain guiding assumptions), and applying the various language features in different ways toward that end.   Notice, therefore, each direction that was taken, what premises were set forth, and what assumptions were made.   Consider why.   There are an abundance of features to choose from in this language; some of these, at first blush, may seem quirky and odd.   There is no “one way,” and that’s exactly what makes this pragmatic and very-practical language so powerful.   It has been called the Swiss Army® Knife of computer programming, and this statement is true.

When you first encounter Perl, especially if you’ve used other languages, you tend to think, “Okay, what’s the way to do it, and I will learn that, and then:   I Have Learned Perl.™”   You very quickly realize that it’s just not that way.   The sheer diversity of how different people solve the same problem using the same tool can be downright confounding and off-putting at first.   Then you begin to see why the community calls itself, affectionately, Perl Monks.   They’re not being cagey or obtuse ...