>>>>> "VB" == Vicki Brown <vlb@cfcl.com> writes: VB> # Data: VB> # apple, banana, cabbage, dillpickle, eggplant, fig, grape VB> # Desired result: VB> # Break the data into fields; fields are separated by ", " VB> # Store each field separately VB> # Problem - VB> # The original code will lose the last entry on the line iff the data VB> # file ever contains more than one line. VB> # Better ideas?? Text::ParseWords #!/usr/bin/perl -w use Text::ParseWords; $line = "apple, banana, cabbage, dillpickle, eggplant, fig, grape"; @words = &parse_line('[,\s]+', 0, $line); print "Original: <$line>\n"; print "Parsed: <",join(">, <", @words), ">\n"; __END__ Original: <apple, banana, cabbage, dillpickle, eggplant, fig, grape> Parsed: <apple>, <banana>, <cabbage>, <dillpickle>, <eggplant>, <fig>, <grape> <chaim> -- Chaim Frenkel Nonlinear Knowledge, Inc. chaimf@pobox.com +1-718-236-0183 ==== Want to unsubscribe from Fun With Perl? ==== Well, if you insist... Send mail with body "unsubscribe" to ==== fwp-request@technofile.org