I want to:
Read a text file line by line.
Structure given in mwe.
Store in an array and sort them by one of its columns.
Sorted array should appear in a latexfile as normal for perltex.
Far away from this aim, I struggle with the handing over from Perl variables to the latex output.
I had found no analog code in docs and net. Also tag "perltex" is missing here, nevertheless I hope that someone can help.
\documentclass[]{scrartcl}
\usepackage{perltex}
% content of text file "verfile" in same dir
% die & Vers\"ohnung & tr. & vers\"ohnen & in alle R. gehend & fehlt \\
% die & Vergoldung & tr. & vergolden & in alle R. gehend & fehlt \\
% die & Vergeudung & tr. & vergeuden & in alle R. gehend & fehlt \\
\begin{document}
\perlnewcommand{\setline}[1]{$line = $_[0]; return ""} %cp perltex doc p.5
\perlnewcommand{\getline}{$line;}
\perldo{
$verfile = "verfile";
open (VF,"$verfile") || die "$!";
while (<VF>) {
$line = $_; # works: print "$line\n";
}
print "after loop: $line\n";
return "\\setline{$line}";
}
\getline
\end{document}
At the moment I expect only one line to see in the output pdf file for the array work lacks. So the problem remains, Why setline doesn't work?