in reply to Re^4: Practicing with files
in thread Practicing with files

If you can't explain it to people who can make educated guesses at what you might mean, how do you expect to explain it to Perl that hardly makes any guesses at all (even bearing in mind DWIM)?

Part of being a good programmer is having a clear idea of what you want your program to achieve and a plan for how you are going go about achieving it. Trying to explain what you want to do to other people is a good way of figuring both those goals out (the Teddy Bear / Rubber Duck effect).

Perl is the programming world's equivalent of English

Replies are listed 'Best First'.
Re^6: Practicing with files
by Discipulus (Canon) on Apr 02, 2014 at 08:01 UTC
    ++GrandFather very well said and explained.
    Even if this remember me a big monk of the past ages: Augustine of Hippo told: "What then is time? If no one asks me, I know what it is. If I wish to explain it to him who asks, I do not know." in Confessions.

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^6: Practicing with files
by Jabox (Sexton) on Apr 02, 2014 at 13:09 UTC

    I don't know how else to say it if what I said don't even make sense to others.

    But let me try to give another example

    Right now the list of lines in a file reads

    Apple

    Orange

    Grape

    SO, if I type grape in once, it says it doesn't exist according to the snippet on the first post.

    It only works if I type grape in 3 times to get to the 3rd line, it's all in the same file

    I don't want to type the same word 100 times to check all 100 lines before I get to the one I want*******

    I want to type in only 1 word, reads every line, if it exist, then remove it and add to the other file.

    I really hope this is more understandable.

      I don't want the if $_ stop only on one line, I want it to loop every line before it goes to else

      I found my solution, had to add this to match it more than once.

      if ($_ =~ m/([$ans]+)/) {