|Just another Perl shrine|
Splitting on tabs then removing extra white space with mapby c4onastick (Friar)
|on Sep 18, 2007 at 01:58 UTC||Need Help??|
c4onastick has asked for the
wisdom of the Perl Monks concerning the following question:
I'm parsing a file that's tab-delimited, except it has a bunch of extra white space around the values that I'd like to remove. I can't just use split on white space, because there's mixed values (some floats, that I'd like to remove the white space from, and some strings that can have white space).
My first attempt was this:
But I get this:
Which definitely makes me think I have a context error going. What's the appropriate way to do this? (I know that the s/\s+// will remove the white space in the text too, I'm ok with that for now, I'd like to remove it from around the floats first.)
Effective use of map has always been my Everest, and with your help I will summit it this time!
Thanks in advance for your wisdom!