[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] bug?



Hi everyone, possible bug. Sorry if this is not the right place to post it.

Mac Perl 5.2.0r4, PPC, patch level 5.004

-------- Original Message --------
Richard Cook <rscook@socrates.Berkeley.EDU> writes:

> > > does this do what I think?
> > >
> > > while(<IF>)
> > > {
> > > my $line = $_;
> > > chomp $_;
> > > s/\t//g;
> > > if(length($_)%2){
> > >    print $line;
> > >    $n++;
> > >    }
> > > }
> > > if($n==1){print "Only a single match.\n";}
> > > else{print "Exactly $n matches.\n";}
> > >
> > > i'm trying to use the modulus operator to find lines with an odd number
> > > of chars, once \t and \n are stripped.
> > 
> > that looks right.
> > 
> > > oh, and i think i found a bug in mac perl.
> > >
> > > if i run the above without chomp, then it prints all lines in the file,
> > > since all lines chomped have an even number of chars. thing is printed
> > > to STDOUT all looks fine, but the copied line
> > >
> > > \xDB\xAA\t\n
> > >
> > > pastes as
> > >
> > > \xDB\xAA\n\n
> > >
> > > where \n is mac CR. any idea what's up??? if instead i print OF to HD,
> > > it prints
> > >
> > > \xDB\xAA\t\n
> > >
> > > just as it should.
> > 
> > hmm.  strange.
> > what if you change the print statement to `print "{$line}"'.
> 
> well, if i use `print "$line";' (w/o the curlies) it works right. 'tsup
> with that?

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org