in reply to Match two files using regex

You declare my $value inside the loop, so that variable will cease to exist once the loop exits. You need to move your test inside the loop, and don't re-declare the variable. That's the first problem I see.

Dum Spiro Spero

Replies are listed 'Best First'.
Re^2: Match two files using regex
by chemshifts (Initiate) on Jun 02, 2015 at 19:35 UTC

    I see, I guess it's the same for the fields variable as well...

      Yep. I strongly suggest you get familiar with the Perl debugger. It will be an enormous help to you as you learn the language. You can inspect the values of variables while the program is running. I frequently use it to try out syntax, especially when dealing with references.

      Dum Spiro Spero