Just another Perl shrine | |
PerlMonks |
removing all whitespace but newlinesby blacksmith (Hermit) |
on Jan 28, 2003 at 19:18 UTC ( [id://230693]=perlquestion: print w/replies, xml ) | Need Help?? |
blacksmith has asked for the wisdom of the Perl Monks concerning the following question:
Okay I have resolved my initial problem. Actually resolved it because writing this gave me an idea to a different approach to resolution. This is what I had going on. I have a .txt file that I am trying to upload to a mainframe for processing. Each record in the file should only be 12 characters long. But, the file that was sent to me to upload has a large amount of whitespace (this includes one \n) trailing the 12 digit record. The FTP step in the mainframe job rejects the file since it is looking for a 12 digit record. So here is what I am trying to do. I am trying to find a way to delete to "spaces" and leave the newline. For some reason everytime I negate \n it doesn't work correctly. Or, I should say the way I want it to work. Perl doesn't lie. I always works correctly. I just don't always script correctly. I went about fixing this issue by using sprintf. I felt this would be more acurate since the record length must be 12, no more, no less. But, I am still curious. How do you delete all whitespace but the newline? blacksmith
Back to
Seekers of Perl Wisdom
|
|