in reply to How can I enter the data of different variables from a text file into a perl program?

open; split and on-and-on....

or, if your learning style is compatible with examples...check Super Search for threads here dealing with the issues you face, and see also http://www.perlmonks.com/index.pl?node=Tutorials#Input-and-the IO tut in our Tutorials section.

But a couple points about your question:

  1. Is the data sample you posted an example of a single line (record) in data.txt or are each of the label:value pairs on a separate line or something else entirely? (Implicit hint made explicit: your questions will generally get quicker and better help if your problem statement is precise.)
  2. Your question suggests that you might hope to learn Perl by studying the syntax of some functions. That's probably sub-optimal. The "chapters" element is likely a better route, and which text to recommend depends (to some extent) on the extent your prior experience as a programmer.
    But without that info, it's hard to do better than recommending Learning Perl, 6th ed. But beware: the first several hits if you simply Google the title appear to be UNauthorized ... ie, ripoffs of the authors and O'Reilly.

Edits for fact, spelling and references. Aaagh!

  • Comment on Re: How can I enter the data of different variables from a text file into a perl program?