I have not been able to make the following code work yet and would like to
hear your suggestion for a better option.  The following is my thought at
this point.

Use strict and warnings :)

print "    {       labels =\n";
print "\t\t (\n";
open IN "tag.txt";
That shoudl error out because there;s no comma after IN
or die $!;

while (<IN>) {
        @line = split(/\t/);
        print "\t v=""@line[0]";";
        print "l=""@line[1]";";
        print " p= "@line[2]";";

These would all fail because the "'s are not escaped, have you even tried executing the code?


I think you want $line[n] instead of @line[n]

        };

Thanks,

Try this:

#!/usr/bin/perl

use strict;
use warnings;

open IN, 'tag.txt' or die $!;
while (<IN>) {
  my ($v,$l,$p) = split /\s+/;
  print qq(\t v="$v"\;l="$l"\; p= "$p"\;\n);
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to