Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Align given substring(s) in lines

by haukex (Bishop)
on Apr 28, 2021 at 19:27 UTC ( #11131815=note: print w/replies, xml ) Need Help??


in reply to Align given substring(s) in lines

As to your example, note perltidy does this too, though of course it only works on Perl and does a whole lot more as well.

$ cat example.pl my $string = 'some value'; # these my $int = 12; # are my $float = 1.2; # scalars $ perltidy -b example.pl $ cat example.pl my $string = 'some value'; # these my $int = 12; # are my $float = 1.2; # scalars

Replies are listed 'Best First'.
Re^2: Align given substring(s) in lines
by johnaj (Acolyte) on Apr 28, 2021 at 20:06 UTC
    That's neat -- I've never used perltidy, as I'm not a really big fan of automated/mandated coding style (unless I'm reading obfuscated code), but that's a pretty good use case.
      I'm not a really big fan of automated/mandated coding style (unless I'm reading obfuscated code)

      When I'm writing code, I just write it in my own style anyway, and when working on someone else's code that has a consistent style I usually try to copy that. I basically only use perltidy when someone else's code is hard to read (like some of the questions posted here sometimes have mixed up indentation), and I've worked out my own perltidyrc that produces output that's close enough to my own style. Running perltidy on my code would usually mess up my style in a few small places so I don't do that :-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2021-07-31 21:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?