On Wed, Nov 27, 2002 at 12:12:46AM +0000, Nicole Seitz wrote: > Hi there! > > I've just started to learn OOP with Perl.With the help of perltoot I wrote a > class Person and some methods(see below). > > package Person;
[ snip implementation ] > To store some data in my object I did the follwing: > > use Person; > > $myPerson = Person->new(); > $myPerson->cname("John"); > $myPerson->sname("Smith"); > $myPerson->street("Euston Road"); > $myPerson->city("London"); > $myPerson->phone("414 3344"); > > > Do I really need all these methods? > I get my data from an comma separated file;lines in this file look like this: > ;John;Smith;Euston Road;London;414 3344;; > > So, after opening the file and reading from it line per line, > what's the best way to store the data in an object? Can I do it in one step?I > mean, without using several methods(cname,sname,...)??? Of course. Just write a method which accepts the string, splits on the semi-colon, and assigns the result to the appropriate fields. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]