in reply to Re^3: Perl program to look into the phone directory and in case of a match, print the name along with the number
in thread Perl program to look into the phone directory and in case of a match, print the name along with the number

> If EOF happens before EOL, then it returns "false" so this last "not quite complete line" is not processed.

Such a behaviour would be strange, inconsistent, and against the documentation, see readline:

> each call reads and returns the next line until end-of-file is reached, whereupon the subsequent call returns undef .

I'd report it as a bug.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
  • Comment on Re^4: Perl program to look into the phone directory and in case of a match, print the name along with the number
  • Select or Download Code

Replies are listed 'Best First'.
Re^5: Perl program to look into the phone directory and in case of a match, print the name along with the number
by Marshall (Canon) on Feb 14, 2017 at 22:43 UTC
    This is indeed strange and contrary to my C experience. No doubt about that! I just re-ran my test cases and get the same results. This is the only way I could duplicate the OP's symptoms. This did surprise me! I did not expect this result.

    I am using:
    "This is perl 5, version 20, subversion 2 (v5.20.2) built for MSWin32-x86-multi-thread-64int (with 1 registered patch, see perl -V for more detail)"
    On Win XP with all patches before end of life.

    It would be helpful if the OP or others could replicate this result on a different Windows version. Something is very odd about this. I agree! I suppose that there could be Windows problem with my ancient laptop. For a bug report, I'd like additional independent verification with exact versioning information. The more detail contained in the bug report and the easier the problem is to reproduce dramatically increases the probability that it will get fixed.

        In any event, you are correct. This is a regex issue.