I'm brand new at PERL and really have no idea what I'm doing. The professor of my class just threw us this program to write and I don't even know PERL syntax and I'm scrambling to get it done. Basically we have to read in a file that has fake student information on it and then convert it to HTML. The file looks something like this: 123456,Susie_Smith,Computer_Science,ssmith@usomewhere.edu 234567,John_Smith,Computer_Engineering,jsmith@usomewhere.edu
Where the first number is the student ID,then name, major, and email address.
After opening the file it is suppose to look like this as an output:
ID: 123456
Name: Susie Smith
Major: Computer Science
Email: ssmith@usomewhere.edu
etc.
I've got to the point where I can open the file and read it out but it looks like this:
ID: 123456
ID: Susie Smith
ID: Computer Science
ID: ssmith@usomewhere.edu
How do I break up each sentence on the .txt file (without changing it) so that it displays what it needs to? My code looks like this:
#!/usr/bin/perl use strict; use warnings; open FILE, "/home/ajb004/Paradigms/roster.txt" or die $!; while ( <FILE> ) { $_; my @word = split(','); foreach my $word (@word) { $_ = $word; s/_/ /g; print "ID: $_\n"; } }
Am I even on the right track?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |