| 1 | 2 | ▶ | use 5.10.1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | package String::Stomp; | ||
| 5 | |||
| 6 | 2 | our $VERSION = '0.0103'; | |
| 7 | # ABSTRACT: Removes empty leading and trailing lines | ||
| 8 | 2 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |
| 9 | |||
| 10 | 2 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | our @EXPORT = qw/stomp/; | |
| 12 | |||
| 13 | 7 | ▶ | sub stomp($) { |
|
Subroutine
stomp: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | 7 | my $string = shift; | |
| 15 | |||
| 16 | 7 | $string =~ s{\A[\h\v]*\v(?=\h*[^\h\v])}{}; | |
| 17 | 7 | $string =~ s{([^\h\v]\V*)\v[\h\v]*\z}{$1}; | |
| 18 | |||
| 19 | 7 | return $string; | |
| 20 | } | ||
| 21 | |||
| 22 | 2 | 1; | |
| 23 | |||
| 24 | __END__ | ||