c/src/Makefile: Create and use `INSTALL_TARGETS`
[sunny256-utils.git] / perlfold
blob13e30897d271eddfcf9be0e53861b95a000db28e
1 #!/usr/bin/env perl
3 # perlfold
4 # File ID: 5869cb92-5d42-11df-bb0e-90e6ba3022ac
5 # Inserts fold marks in perl source before and after stdin.
6 # Select text in visual line mode and filter the block through this script.
8 use strict;
9 use warnings;
11 $| = 1;
13 my $Line = <STDIN>;
14 my ($Indent, $Title) = ("", "");
16 defined($ARGV[0]) && ($Title = join(" ", @ARGV) . " ");
17 $Line =~ /^(\s+)/ && ($Indent = $1);
18 print("$Indent# $Title\x7B\x7B\x7B\n$Line");
20 while (<STDIN>) {
21 print($_);
24 print("$Indent# \x7D\x7D\x7D\n");