Sure, you can get by with one global by using the empty first place in the global @l.
#!/usr/bin/perl -w -p s/^(\*+)/ # use only one global by using empty first place in @l my $n = length($1); $n < $l[0] ? @l[$n+1..$#l] = (0)x($#l-$n) : 0; $l[$n]++; $l[0] = $n; join(".",@l[1..$n]); /e;
Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com
In reply to Re: Re: Emacs Outline Mode Header Numbering
by clemburg
in thread Emacs Outline Mode Header Numbering
by clemburg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |