Trim - Trim various things by removing leading and trailing whitespace
Trim nested structures in situ referenced from $_:
{$_ = [" a ", " b ", {" c " => {" d\n ", " e "}}]; trim; is_deeply $_, ["a", "b", { c => { d => "e" } }]; }
Trim nested structures in situ:
{my $a = [" a ", " b ", {" c " => {" d\n ", " e "}}]; trim $a; is_deeply $a, ["a", "b", { c => { d => "e" } }]; }
Trim cloned nested structures:
{my $a = [" a ", " b ", {" c " => {" d\n ", " e "}}]; my $b = trim $a; is_deeply $b, ["a", "b", { c => { d => "e" } }]; }
Trim various things by removing leading and trailing whitespace
Version "20210401".
The following sections describe the methods in each functional area of this module. For an alphabetic listing of all methods by name see Index.
Trim strings, arrays, hashes in situ and clones thereof.
Trim somethings.
Parameter Description 1 @things Things to be trimmed
Example:
$_ = [" a ", " b ", {" c " => {" d ", " e "}}]; # Trim nested structures in situ referenced from $_ trim; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲 is_deeply $_, ["a", "b", { c => { d => "e" } }]; } {my $a = [" a ", " b ", {" c " => {" d ", " e "}}]; # Trim nested structures in situ trim $a; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲 is_deeply $a, ["a", "b", { c => { d => "e" } }]; } {my $a = [" a ", " b ", {" c " => {" d ", " e "}}]; # Trim cloned nested structures my $b = trim $a; # 𝗘𝘅𝗮𝗺𝗽𝗹𝗲 is_deeply $b, ["a", "b", { c => { d => "e" } }];
1 trim - Trim somethings.
This module is written in 100% Pure Perl and, thus, it is easy to read, comprehend, use, modify and install via cpan:
sudo cpan install Trim
philiprbrenan@gmail.com
http://www.appaapps.com
Copyright (c) 2016-2021 Philip R Brenan.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
To install Trim, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Trim
CPAN shell
perl -MCPAN -e shell install Trim
For more information on module installation, please visit the detailed CPAN module installation guide.