in reply to Strange File read problem

here are a few ideas for you to try: print @lines; - print can take a list. perhaps the problem is in the loop? unlikely. it's probably in the assignment somewere while (<FILE>){ print } - print the lines as you read them, instead of many at a time. If this works and the prior solution doesn't i suspect something has gone wrong in you assignment to @lines.

This is very odd behavior indeed. The code works perfectly on my machine, and there is nothing in it to go wrong. Perhaps something is wrong with your terminal?

-nuffin
zz zZ Z Z #!perl

Replies are listed 'Best First'.
Re: Re: Strange File read problem
by abhishes (Friar) on Apr 09, 2003 at 15:26 UTC
    I created a second file like
    package m.y; import n.a.m.e; import i.s; import a.b.h.i.s.h.e.k; import s.r.i.v.a.s.t.a.v.a;

    It worked perfectly as well. so to me it looks that nothing wrong with the terminal or loop.

    I am on W2k, active state perl 5.8.0

    I print the number of lines at the end of the for loop for Sample.java it says number of lines is 1. for sample2.java it says number of lines is 5.

    regards,
    Abhishek.
      There's obviously somethine wrong with the file. If slurping didn't work, and the same stuff works for other files then the OS is at fault. I think. Perl is not sensitive to the content of the file. The readline library - perhaps you can say that, but generally no. I think the lines are simply not there. Rewrite the file to a new one, and see if the problem returns.

      -nuffin
      zz zZ Z Z #!perl