Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- use strict;
- my $in_vcard = 0;
- my @codestack;
- while (<>) {
- if (/\{\s*$/) {
- push @codestack;
- $in_vcard = 1;
- next;
- } elsif (/\}\s*$$/) {
- if ($in_vcard) {
- if (len(@codestack) > 2) {
- # just dump code
- foreach my $line(@codestack) {
- print;
- }
- print;
- } else {
- my $line = $codestack[0];
- $line =~s/\{\s*$//;
- print "$line\n";
- print $codestack[1];
- }
- $in_vcard = 0;
- @codestack = ();
- }
- } else {
- if ($in_vcard == 1) {
- push @codestack;
- } else {
- print;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement