in reply to Re^2: Opening a file, editing, copying to another
in thread Opening a file, editing, copying to another

Ahh ++ I wasn't aware of that. That seems to be a sloppy way of doing things in my mind, even though it is a quicker shorthand.

In any case I do not see where $_ is ever being set. Running the code myself it comes up empty for every iteration. The data that he wants to operate on is stored in his 2-D Array $list[][]. It makes complete sense that nothing is sent to his files because $_ is empty.

Thanks for pointing out my mistake ;) Although I know about $_ I rarely use it. I find it more readable to explicitely name my variables, and it aids in maintainability for future changes.

Replies are listed 'Best First'.
Re^4: Opening a file, editing, copying to another
by GrandFather (Saint) on Jun 21, 2007 at 14:25 UTC

    You have to know about and use $_ if you use map, grep or for (as a statement modifier) and for various common Perl idioms. If you are not using map, grep or statement modifiers then you are missing out on some major workhorses in Perl.

    In the op's situation I agree that using a variable is likely to make the intent clearer, but there are a multitude of problems with the code apart from that.


    DWIM is Perl's answer to Gödel