William Black am Sonntag, 22. Januar 2006 15.33: > Hello, > > I'm reading from a file. I'm trying to read in five lines at a time where > each line has a newline and then process the lines into separare variables. > For example, > > Input File > ------------- > Stevens, > Craig A Triangle Family Care PA > 106-A Ridgeview Dr > Cary, NC > View Profile & Phone | Appointment Services 0.4 > Once the lines are read in, I want to store 'Stevens' into a Lname > variable, 'Graig' in a Fname variable, 'A Triangle Family Care PA' into > BusName variable, '106-A Ridgeview Dr' into a Address variable, 'Cary' into > a City variable, and 'NC' into a state variable. Could someone point me in > the right direction?
A great part of the direction is the answer by Shawn to your previous answer, where you intended to read 4 lines at a time instead of 5. In Shawn's answer are the two lines: # process @lines print Dumper [EMAIL PROTECTED]; The first tells you where to process the accumulated lines, the second shows you the structure of @lines. Now you want parts of the lines assigned to some variables. For that, please read about the possibilities to get substrings from a string: perldoc -f split or, for more complicated cases: perldoc perlre and the other manuals mentioned therein at the bottom. hth, joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>