in reply to Re (tilly) 1: New sections and move one
in thread New sections and move one
Again, this could be the start of the "String related" category of the Perl Monks' "Subroutine Library." I don't think these kind of onezie subroutines would find a welcome home in CPAN as one routine per submission. If they were in a module, then I have the same 'discovery' and 'install' problems I have today. As onezies they would fail CPANTS for sure not being modules!sub rtrim { # Right trim spaces my @out=@_; for (@out) { $_ = reverse $_; s/^\s+//; $_ = reverse $_; } return wantarray ? @out : $out[0]; } sub ltrim { # Left trim spaces my @out=@_; for (@out) { s/^\s+//; } return wantarray ? @out : $out[0]; } sub trim { # Trim extra spaces from both left and right my @out=@_; for (@out) { s/^\s+//; s/\s+$//; } return wantarray ? @out : $out[0]; } sub trimall { # Trim all extra spaces from both left and right and middle my @out=@_; for (@out) { $_= join ' ',split; } return wantarray ? @out : $out[0]; }
..:::::: aquacade ::::::..
|
---|
Replies are listed 'Best First'. | |
---|---|
Still unconvinced, sorry
by tilly (Archbishop) on Aug 12, 2001 at 21:17 UTC | |
by aquacade (Scribe) on Aug 12, 2001 at 22:42 UTC | |
by footpad (Abbot) on Aug 12, 2001 at 23:23 UTC | |
by aquacade (Scribe) on Aug 13, 2001 at 19:24 UTC | |
by $code or die (Deacon) on Aug 12, 2001 at 23:17 UTC | |
Re: Re: Re (tilly) 1: New sections and move one
by elusion (Curate) on Aug 13, 2001 at 03:42 UTC |