MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: - limited from a pipe?

  • To: mathgroup at
  • Subject: [mg104007] Re: - limited from a pipe?
  • From: Bill Rowe <readnews at>
  • Date: Thu, 15 Oct 2009 07:17:48 -0400 (EDT)

On 10/13/09 at 11:21 PM, jasonbrent at (Jason Ledbetter)

>Folk, I'm looking into various methods of importing data into
>mathematica from a piece of perl middleware (that talks to a
>database). Right now, the perl script is outputting CSV that I'm
>pulling in with Import[....,"CSV"] or "List" in some cases.

>In investigating other options (like Get) it seems that there are
>some limitations on Import[] that I don't quite understand.

>As a test, I'm looking at two components:

>1 - a perl script that outputs "List[1,2,3,4]" (no newlines) and
>then exits. 2 - the output from that perl script redirected to a
>file "foo"

If you are going to have your perl script output valid
Mathematica expressions, then you should use Get not Import.

Import is intended to read a wide variety of file formats and
convert the contents to a Mathematica expression. Get merely
evaluates Mathematica expressions in a file, returning the last one.

Import has quite a bit of overhead associated with recognizing
the file format and converting the contents to valid Mathematica
expressions. It is clearly more efficient to avoid this overhead
when you have valid Mathematica expressions at the start.

  • Prev by Date: Re: The graph of (x + 2)^(1/5) + 4 not plotted
  • Next by Date: Re: Import[] - limited from a pipe?
  • Previous by thread: closing curly brace unrecognized
  • Next by thread: Packaged Dynamic Problem