in reply to How to use __DATA__ efficiently, help!

Data::Section will give you the possibility to access multiple sections in your __DATA__ area.

The unitialized value warning (it is not an error message, just a warning only) is probably because you have empty lines in your __DATA__ area. I wouldn't worry about it too much.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: How to use __DATA__ efficiently, help!
by ikegami (Patriarch) on Feb 09, 2011 at 19:51 UTC

    it is not an error message

    He made an error (concatenated two variable without giving either a value) and Perl issued a message in response to that error. How is that message not an error message? It's simply not an (immediately) fatal error.

    is probably because you have empty lines in your __DATA__ area.

    No, he gets the warning before even executing <DATA> because he's using a bottom tested loop.

      He made an error (concatenated two variable without giving either a value) and Perl issued a message in response to that error.

      Then we have different definitions of error and warning.

      The OP concatenated nothing to nothing (and thus wastes a cycle of that loop) but his output is still correct. In my book that is not an error, but it does warrant a warning as it can be written better.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        The output isn't correct. $data does not contains what it should at all.