in reply to Re^2: How to Save a variable outside of a loop
in thread How to Save a variable outside of a loop

That'll yield a warning:

c:\@Work\Perl\monks>perl -wMstrict -le "my $x = ''; print 'equal' if $x == 1; " Argument "" isn't numeric in numeric eq (==) at -e line 1.


Give a man a fish:  <%-(-(-(-<

Replies are listed 'Best First'.
Re^4: How to Save a variable outside of a loop
by Laurent_R (Canon) on Aug 01, 2015 at 12:18 UTC
    Yes, AnomalousMonk, you're right, I did not pay attention to the fact that the code is using numeric comparison. I'm doing this type of things regularly, but usually with the string eq operator, even when the data string is numeric (say a customer number or a phone number with only digits). Reducing the number of operations made in the while (<$fh>) loop makes some sense when removing duplicates from a 500-million-line file.