Re: Shortening a script, but aiming for efficiency
Alan Young <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
> 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/\|+$/ /; -- Alan