Last active
January 2, 2016 23:09
-
-
Save takumikinjo/8374531 to your computer and use it in GitHub Desktop.
Fill the columns of a outline text.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# outlinefill.pl <outline indent chars> <output delimiter> | |
@b = (); | |
while (<STDIN>) { | |
chomp; | |
@a = split /$ARGV[0]/, $_; | |
@b = () if ($#a < $#b); | |
foreach $i (0 .. $#a + 1) { $b[$i] = $a[$i] if ($a[$i]) } | |
print join(eval("\"$ARGV[1]\""), @b)."\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment