[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MySQL and loading tables from a file.



Jason Burke said:
>   @fields = split(/,/, $_);   # I don't think I need to escape the , here.

Unfortunately, that's overly simplistic.  Excel likes to do things
like

    "a field","a field that's really, really hard to parse",etc.

If you just split on /,/, you'll get

    (q/"a field"/, q/"a field that's really/, q/really hard to parse"/,
     q/etc./)

Not exactly right, huh?

It would probably be better to look at either the DBD::CSV module or
the Text::CSV module.

Steve
-- 
steve@silug.org           | Southern Illinois Linux Users Group
(618)398-7320             | See web site for meeting details.
Steven Pritchard          | http://www.silug.org/
-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.