Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^4: chop vs chomp

by Moron (Curate)
on May 11, 2007 at 13:25 UTC ( #614904=note: print w/replies, xml ) Need Help??

in reply to Re^3: chop vs chomp
in thread chop vs chomp

Only at a lower level in the sense that $/ doesn't actually help anything if you wrote it properly with a lexical analyser. But you are clearly not up to the level of seeing that with a lexical analyser in play, you really don't want chomp() in there either and so all things considered...

Yes, I agree, you should be sorry for your arrogance.


^M Free your mind!

Replies are listed 'Best First'.
Re^5: chop vs chomp
by Fletch (Chancellor) on May 11, 2007 at 13:57 UTC

    You persist in raising the strawman of using chomp on non-record oriented input. Yes, if you've got non-line oriented files you shouldn't be trying to process it line-by-line and using chomp. And if you look you'll find that probably most of the regulars telling you you're off your chum are the first to, for instance, point someone at HTML::TokeParser when someone's attempting to treat HTML as line oriented input.

    However if you persist in insisting that a sawzall is all you ever use and that everyone else is wrong in not using them as well for everything they might be doing as well (vascular surgery, engine maintenence, animal husbandry) you can't expect to be taken seriously.

    Update: Changed first "non-line oriented" to the more generic "non-record oriented".

      It's narrower than that: the only situation where it is reasonable to use chomp() is where:

      1) the format of the records is delimited rather than fixed width.

      2) the absence of a trailing line terminator on the last line is permissible; usually because the file has been manually created.

      3) the only whitespace permitted at the end of the line is the carriage return - otherwise you wouldn't do it, you'd pattern-match.

      (Update: I mean of course to say: where all three conditions apply rather than just a subset of them)

      Such conditions are clearly exceptional rather than the rule, yet replies to this thread confirm my suspicion that people tend to assume their use of chomp() can be assumed as being in response to a "normal" textfile case.


      ^M Free your mind!

        They aren't the exception for everyone. In fact 1,2,3 are normaly true for any project i'm working on.

        Eric Hodges
Re^5: chop vs chomp
by Chady (Priest) on May 11, 2007 at 13:43 UTC

    I downvoted you for attacking me, instead of talking about what I wrote in my post.

    My point is, which you clearly don't want to see given that so many others have been trying to uselessly make you understand, is that you are micro-managing a feature, that YOU yourself created, because it doesn't fit your original design, and instead of admitting that your original design is flawed because it is based on some wild assumption, you still insist on generalizing that the feature is wrong to use in all other situations.

    I was going to come up with an alternative example, but shmem already gave an excellent one (the one about autovivification).

    Now let's please hear about how stupid I am, and how much I'm still lacking in knowledge about all this "computer" stuff... oh.. and about my bad english too.

    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
    Chady |
    Are you a Linux user in Lebanon? join the Lebanese GNU/Linux User Group.
      A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://614904]
[mithaldu]: ugh, i'm glad my question got a useful answer, but i am disheartened to see that, stackoverflow- style, the correct answer is buried below one that looks superficially appropiate, but entirely misses the point of the question
[hippo]: Hardly "buried". Just upvote the good nodes and move on.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-08-14 08:45 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (146 votes). Check out past polls.