in reply to Extracting data from a string

Hi

Did you try with split option. Hope you did

$var='nc,71526435,0,"text text, text text,456 etc...",36.5,121.1,1.4,7 +.50, 8,"text2 text, text text,123 etc..."'; @array=split(",",$var); while(<@array>) { print $_ ."\n"; }

And also you may try with modules as suggested above.

Replies are listed 'Best First'.
Re^2: Extracting data from a string
by ikegami (Patriarch) on Feb 21, 2011 at 09:30 UTC
    Did you? Run your program.
      Hi, Yes. It's a mess, because the text between quotes has also commas. Kind regards, Kepler

        So what was the point of your post? [ ack! Thought the parent was from viveksnv ]

        Not to detract from split's uselessness here, note that most of the "badness" came from «while (<@array>)» when you meant to use «for (@array)». «while (<@array>)» is equivalent to «while (defined($_ = glob(join($", @array))))».