![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
Re^3: Selecting the difference between two stringsby hgolden (Pilgrim) |
on Sep 26, 2006 at 22:22 UTC ( [id://575033]=note: print w/replies, xml ) | Need Help?? |
I don't know much about Perforce, but from what you've said, there are probably easier ways to do this than what you're asking for. If all of the information is of the format that you show in your original post, you could pretty easily form an indented list showing the branches. For simplicity, let's call the text between slashes units. Now, sort the list ASCIbetically, and do a very simple loop that preserves the entry above. By comparing the current entry to the above entry, you could determine the number of tabs to print before the current entry. I.E if they have no units in common, we would print no spaces. If they have three units in common, but are both longer than three units, then we insert three tabs. If they have three units in common, but the above entry is only three units long, then we need four tabs. Anyway, you can fit the particulars to what you want. To me, a Perl solution is one that's elegant in Perl, and not one that takes advantage of Perl's string abilities. Hays
In Section
Seekers of Perl Wisdom
|
|