split/Perl question

David A. Sinck plug-discuss@lists.plug.phoenix.az.us
Mon, 11 Nov 2002 13:42:13 -0700


\_ SMTP quoth Mike Starke on 11/11/2002 15:33 as having spake thusly:
\_
\_ /_
\_ /_There's a couple of possible solutions, depending on how many fields
\_ /_have :-dirty data, but without samples, I'm not going to go into
\_ /_whatifs.  :-)
\_ /_
\_ 
\_ David:
\_ Here is a sample, however, since these values are obtained from a web form
\_ (and I can not change the delimeter), there is no telling which field may
\_ contain the same value as the delimeter. However, there is a fixed amount of fields.
\_ 
\_ mike@megconsult.vom:mikest:meg@lilly.csoft.net:Mike:Starke::::::::::Phoenix:Arizona:85050:::::::::::::com576:1/31/2001::602.992.xxx:999 Hurten Way:::http://www.megconsult.com:0

Well, first see if it's a good line or not with

$count = tr/:/:/;

And see if you have to worry or not.

If you do, try a @parts = split(/:/, $_); and parsing down each @part
and perhaps reconstructing based on homebrew metrics.

Past that, try Hans' idea and hope.  :-)

David