in reply to Help Me!

A for loop over the "words" is not going to do it for you. The array name should be words btw (there's probably more than one of them)! You can access individual words using their index (starting at 0) as $words[0] (for the ID) so you could print out the id using:

print "ID: $words[0]\n";

for example. You ought to be able to take it from there.

Out of curiosity, how did you get to the code you have already? There are some good things about it, and a couple of less good things. Using strictures is excellent. But you should be using the three parameter version of open and lexical file handles:

open my $inFile, '<', $filename or die "Can't open $filename: $!\n";
True laziness is hard work

Replies are listed 'Best First'.
Re^2: Help Me!
by ajbrewe (Novice) on Apr 10, 2011 at 01:50 UTC

    Thank you for that! It helped a lot! I got this code from Ben Okopnik "Learning Perl". What would be the best way to convert the output to HTML. It's suppose to look like this by the end of everything:

    <HTML> <HEAD> <TITLE>Class Roster</TITLE> </HEAD> <BODY> <TABLE> <TR> <TD>ID: 123456</TD> <TD>Name: Suzie Smith</TD> <TD>Major: Computer Science</TD> <TD>Email: ssmith@uark.edu</TD> <TD>Parking Fees Owing: $22.00</TD> </TR> <TR> <TD>ID: 777777</TD> <TD>Name: John Brown</TD> <TD>Major: Computer Engineering</TD> <TD>Email: jbrown@uark.edu</TD> <TD>Parking Fees Owing: $0.00</TD> </TR> </TABLE> </BODY> </HTML>

      I'd suggest first you play around with the code you have and understand it. Once you understand what you've got the rest is just fiddling with the details.

      There are modules in CPAN that help generate correct HTML, but for the present probably the simplest approach is best.

      Note that the indentation is not required for HTML, although it makes it easier for humans to validate.

      True laziness is hard work
Re^2: Help Me!
by JavaFan (Canon) on Apr 10, 2011 at 05:57 UTC
    But you should be using the three parameter version of open and lexical file handles
    No, in this case, two parameter open, and a file glob is just fine.

    Note for instance that lexical file handles have been with us since 5.000. It wasn't until they also got to be autovivifying that they got more popular.

    I think it's for starters (actually, everyone) far more important to get their programs correct, before worrying about the nuances between 2-arg and 3-arg open, or globs and autovivifying filehandles.