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

Re: [MacPerl] The S)ubstitute command



Chris Nandor wrote:
> 
> Q: did you check the data before the substitution?
> 
>   print "<$name>";
>   $name =~ s/scratch.*$//;
>   print "<$name>";
> 

Yep.  The name fields are exactly 20 characters long.  The numeric
fields are all f8.4 or rather %8.4f.  (The f8.4 is from FORTRAN which
some people feel is a dirty word now-a-days.  ;-)  Anyway, I first did
remove all trailing blanks via the

	$name =~ s/\s+$//;

Which seemed to work fine.  I printed everything out and all of the
names were printed without trailing blanks.  Then I noticed that I had
not taken out the word "scratch" and anything trailing it.  That was
when I put everything through a program which just read everything in,
went through the array substituting out the "scratch.*$" stuff, and
writing it back out.  And the weird trailing blanks thingy happened.  I
tried it a couple of times, got out of MacPerl, got back in - same
thing.  So I tried putting the substitute command which stripped off
trailing blanks on the next line.  That seemed to make it work fine but
that made me decide that there had to be something wrong with my copy of
MacPerl.  So I tried several other things (like CHOMP, CHOP, printing
out the hex values of the information) and everything looked ok - but
those spaces stayed.

*shrug*  Worked ok after re-installing.  So I've just got to keep track
of what I'm doing so I can try to reproduce the problem.  When I get
home that is.  I'm at work right now.  :-)

--------------------------------------------------------------------------------
All e-mail needs to be sent to mark@cheers.jsc.nasa.gov.  If you don't,
it will
probably bounce.  What man does not understand or fears; he ultimately
destroys.
Steve Wright: Black holes are where God divided by zero.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch