in reply to simple question about printing vars

Backticks just return a string, no magic involved. You can't readline (which is what <$var> does) from a string.

A possible solution is to open an in-memory file handle:

open my $handle, '<', \$query or die "Cannot open in-memory file handl +e: $!"; while (<$handle>) { ... }

Or you can use the backticks in list context:

for (`...`) { }

Though for this particular problem, the pipe open is still the best (and least memory hungry) solution.

Replies are listed 'Best First'.
Re^2: simple question about printing vars
by httpd (Novice) on Nov 03, 2011 at 13:11 UTC
    thanks, I will use pipe then.