Loading ...
Sorry, an error occurred while loading the content.

265Re: [NTS] The ANSI 26 character

Expand Messages
  • acummingsus
    Dec 22, 2003
    • 0 Attachment
      --- In ntb-scripts@yahoogroups.com, "Sheri" <silvermoonwoman@c...>
      wrote:
      > Hi Alan,

      There are no spaces. Ntab matters spaces, Perl doesn't, Perl could
      care less.

      The two if lines with 5.006 match.

      print "Current Perl Version is ", $], "\n";
      if ($] > 5.006) {
      print "it's greater than 5.006\n";
      }
      else {
      print "it wasn't greater than 5.006";
      }

      the above works. the next works until the line with 5.006 gets
      activated then it runs but strips doc so doc is empty. At this point
      I'm going to assume it has to do with the context of nearby stuff
      such as the input operator into array @in or etc. since nearby stuff
      is the only difference that exists between these two scripts herein.
      the two use lines on or off doesn't make any difference in the
      result. And I've now 5.8.2 build 807 or whatever the latest is and
      that also makes no difference (previously had 5.8.0 something ver.)

      #!/perl/bin/perl -w
      #use strict;
      #use warnings;
      my (@in, $badchar, $item);
      my $count = 0;
      my $total = 0;
      my $tst = 'affirm';
      @in = <>;
      #if ($] > 5.006) {
      if ($tst eq 'affirm') {
      $badchar = chr(26);
      $count = @in;
      $in[$count - 1] =~ s/($badchar)$//;
      }

      print "This way (using while) needs new lines\n";
      print "(not sure why\? could just add \\n's)\n";

      while (<@in>) {
      $item = $_;
      print $item;
      $total = $total + $_;
      }
      print "--------\n";
      print $total;
      print "\n-----------\n";

      $total = 0;

      print "This way (using foreach) doesn't need new lines\n";
      foreach (@in) {
      $item = $_;
      print $item;
      $total = $total + $_;
      }
      print "--------\n";
      print $total;
      print "\n-----------\n";
      #end
    • Show all 25 messages in this topic