Greetings,
I'm really, really stuck.
I have a text file database, I want to be able assign a variable to each entry in the database and possibly create a new object for each entry on a new line (I hope this doesn't sound too vague).
I know I can do, for example
open(FILE, $file) or die "Cannot open $file: $!\n";
while(<FILE>) {
chomp;($creg, $cname, $attribs) = split(/,/);
}
close(FILE);
But how would I go about creating a new object for each entry (a new entry is on a new line), for example, my text file database is in the format:
UNIQUE ID, NAME, ATTRIBS
UNIQUE ID, NAME, ATTRIBS
etc.
I've been racking my brain to come up with something for days of google'ing, but I've ran out of ideas..
Any help will be lifesaving, litterally! I don't have much time left at all.. :(
maybe something like
foreach $line(@file) {
chomp;($creg, $cname, $attribs) = split(/,/);
$object = $blah->new();
$object->creg($creg);
...
}
I don't know :(
Thank you for your time kind people,
Shibby