Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How do I replace \t and regarding to the alignment requirement ?

by JavaFan (Canon)
on Apr 19, 2012 at 13:47 UTC ( [id://965959]=note: print w/replies, xml ) Need Help??


in reply to How do I replace \t and regarding to the alignment requirement ?

my @l = (0, 7, 6, 5, 4, 3, 2, 1); $str =~ s/\G([^\t]*)\t/$1 . (' ' x $l[length($1) % 8])/eg;
I'm sure it can be done with a closed formula instead of a lookup table, but this was faster coding.
  • Comment on Re: How do I replace \t and regarding to the alignment requirement ?
  • Download Code

Replies are listed 'Best First'.
Re^2: How do I replace \t and regarding to the alignment requirement ?
by PerlOnTheWay (Monk) on Apr 19, 2012 at 14:20 UTC
    This doesn't work for multiple lines.
      Sure it does.

      Unless you mean that you want to restart counting offsets on each newline. But you didn't specify that.

        Yes I want to restart counting offset on newline,sorry for missing that!
          A reply falls below the community's threshold of quality. You may see it by logging in.

      And what should it do for multiple lines?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://965959]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2024-04-25 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found