in reply to candlestick from csv

If your data really looks like this...

["2007/12/18", "34.6400", "35.0000", "34.2100", "34.7400"], ["2007/12/19", "34.6900", "35.1400", "34.3800", "34.7900"], ["2007/12/20", "35.2900", "35.7900", "35.0800", "35.5200"],

...and i understood you right i would try something like this:

#!/usr/bin/env perl use strict; use warnings; use Data::Dump; use Path::Tiny; my $data = path("data.txt")->slurp; # $data = qq(\($data\)); $data = qq{($data)}; my @data = eval($data); dd \@data; __END__ karls-mac-mini:monks karl$ ./slowandsteady.pl [ ["2007/12/18", "34.6400", "35.0000", "34.2100", "34.7400"], ["2007/12/19", "34.6900", "35.1400", "34.3800", "34.7900"], ["2007/12/20", "35.2900", "35.7900", "35.0800", "35.5200"], ]

See also perldsc, eval and Path::Tiny for further information.

Edit: Removed frivolous escapades.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^2: candlestick from csv
by AnomalousMonk (Archbishop) on May 23, 2015 at 21:28 UTC

    Note that  qq// and its ilk are capable of handling balanced paired embedded delimiters  () {} [] <> without frivolous escapades:

    c:\@Work\Perl\monks>perl -wMstrict -le "my $data = 'this is my data'; my $s = qq(($data)); print qq{'$s'}; " '(this is my data)'


    Give a man a fish:  <%-(-(-(-<

      "... without frivolous escapades"

      Thank you for the hint. I should have known this.

      Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»