Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] Perl splitting help

Hi all,

I have a problem as I don't know Perl very well and need to do the

1. Grab a file containing a list of people and phone numbers seperated by a
| .eg.

--- playlist.txt---
George Vieira|0410123123
Another Person|0414321321

2. Split the lines into fields so I can print each field into a cell in a

This is what I have so far but don't understand how "split" works and only
get 1 character. At the moment the bottom is a mess and fails miserably but
just to give you an idea what I'm trying to do...

open (FILE, "/tmp/playlist.txt") ||
          die "Cannot open file for reading\!";
   $players[$nob] = $_;
   $nob = $nob + 1;

foreach @players {
        ($name, $number)=split(/|/,@players[$num]);
print "  <tr>\n";
print "   <td>$name</td>\n";
print "   <td>$number</td>\n";
print "  </tr>\n";
$num = $num + 1;

Can someone help me with this?

George Vieira.