Re: Shortening a script, but aiming for efficiency

[email protected] (Ronald J Kimball)
Newsgroups perl.fwp
Message-ID <[email protected]>
On Fri, Oct 01, 2004 at 09:23:14AM -0600, Alan Young wrote:
> > a\tb\t
> > a\t\t
> > \tb\t
> > \t\t\t
> > 
> > The output for all these should be:
> > 
> > a|b
> > a|\s
> >  |b
> >  |\s
> > 
> > This means that I could start by replacing all tabs with pipes, but then
> >  I would always have to remove the last pipe...
> > 
> > I could replace two ending pipes with "| " (second and fourth cases),
> >  but I would also have to remove a single ending pipe (first and third
> >  cases)
> 
> Then use a '+':
> 
> s/\|+$/ /;

That's not the desired behavior either.  Look at the examples above.

Ronald
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.