On Dec 17, LoneWolf said:

>I am parsing a massive file line by line and cleaning it up.  It has about
>15 fields, all separated by | and I want to remove the white space from
>before and after the pipes so that as the information is parsed it gets rid
>of external white spaces from the string and such.

Then split on /\s*\|\s*/.  That regex reads "zero or more whitespace, a |,
then zero or more whitespace".

  @fields = split /\s*\|\s*/, $line;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to