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

Re: [MacPerl] Code cleaning and questions



On Thu, Jun 24, 1999 at 10:27:52PM +0000, Bart Lateur wrote:
> On Thu, 24 Jun 1999 17:26:23 -0400, Ronald J Kimball wrote:
> 
> >>   my $count = $line =~tr/\200-\377//;
> >>   $count and 
> >>     warn "WARNING -- $count ASCII value(s) exceed(s) 127.\n";
> >
> >That doesn't print the ASCII values of the individual characters.  It seems
> >to me to be a Perlish and much faster way of doing something else.  :)
> 
> Ah? So what ASCII valuie does this line print?
> 
>   $num > 127 and warn "WARNING -- ASCII value exceeds 127.\n";
> 
> None whatsoever. "$num" isn't in the string.
> 

Of course not.  This is the line that prints the ASCII value:

print $num = ord $_;


which was part of this block of code:

foreach (split //, $line) {
  print $num = ord $_;
  $num > 127 and warn "WARNING -- ASCII value exceeds 127.\n";
}


As I said, your code does something else.


Ronald

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