NAME
String::Stomp - Removes empty leading and trailing lines
VERSION
Version 0.0103, released 2017-12-31.
SYNOPSIS
use
String::Stomp;
sub
out {
stomp
q{
A short
text
}
;
}
# is exactly the same as
sub
out {
q{ A short
text}
;
}
DESCRIPTION
String::Stomp provides stomp
, a simple function that removes all leading and trailing lines that only consist of white space or line breaks.
FUNCTIONS
stomp $string
# ' hello'
my
$string
= stomp
q{
hello
}
;
MORE EXAMPLES
Usage with qs
Syntax::Feature::Qs adds qs
and qqs
that removes all leading whitespace from all lines in a string:
# these three packages are equivalent:
package
Example::Stomp {
sub
out {
stomp qs{
This is
a multi line
string.
};
}
}
package
Example::Q {
sub
out {
q{This is
a multi line
string.}
;
}
}
package
Example::HereDoc {
sub
out {
(
my
$text
=
<<" END") =~ s{^ {12}}{}gm;
This is
a multi line
string.
END
$text
=~ s{\v\z}{};
$text
;
}
}
SEE ALSO
SOURCE
https://github.com/Csson/p5-String-Stomp
HOMEPAGE
https://metacpan.org/release/String-Stomp
AUTHOR
Erik Carlsson <info@code301.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.