I'm using a perl script to write another perl script that will be executed later. I need to know if all the characters that need to be escaped, are properly escaped. Can someone help, here's a portion of the code below. Are all the characters properly escaped? (note this is part of a much longer script, and I don't want to type it all out incorrectly which is why I'm asking for advice.)

print FILE ("open my \$totdata, \'\<\', \$totalsFile or die \"Unable to open file: \$\!\"\; \n");
   print FILE ("\t my \$ttline = \<\$totdata\>\; \n");
   print FILE ("close \$totdata\; \n");
   print FILE ("\t my \...@totdata = split \/\~\/, \$line\; \n");
print FILE ("open my \$transdata, \'\<\', \$transnums or die \"Unable to open file: \$\!\"\; \n");
   print FILE ("\t my \$txline = \<\$transdata\>\; \n");
   print FILE ("close \$transdata\; \n");
   print FILE ("\t my \...@transdata = split \/\~\/, \$line\; \n\n");
   print FILE ("\t \$totdata[0] += $transdata[0]\; \n");
   print FILE ("\t \$totdata[1] += $transdata[1]\; \n");
   print FILE ("\t \$totdata[2] += $transdata[2]\; \n");

It should appear in the new script as follows, which works fine:

open my $totdata, '<', $totalsFile or die "Unable to open file: $!";
    my $ttline = <$totdata>;
close $totdata;
    my @totdata = split /~/, $line;
open my $transdata, '<', $transnums or die "Unable to open file: $!";
   my $txline = <$transdata>;
close $transdata;
   my @transdata = split /~/, $line;

    $totdata[0] += $transdata[0];
    $totdata[1] += $transdata[1];
    $totdata[2] += $transdata[2];


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to