in reply to Re: Can't use undefined variable as a symbol reference
in thread Can't use undefined variable as a symbol reference

Any recommendations for reading only the first 30 lines of a file?
  • Comment on Re^2: Can't use undefined variable as a symbol reference

Replies are listed 'Best First'.
Re^3: Can't use undefined variable as a symbol reference
by james28909 (Deacon) on Feb 09, 2015 at 00:37 UTC
    Use a counter. Once counter equals 30, exit loop.
      plus you can let perl do the counting. See perldoc perlvar, search for "$." or "input_line_number".