/ Published in: Perl
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl # subroutine to strip leading and trailing spaces # in a string or an array. # check for the examples below. ################################################################################ # trim() # # Usage: # trim; # trims $_ inplace # $new = trim; # trims (and returns) a copy of $_ # trim($str); # trims $str inplace # $new = trim($str); # trims (and returns) a copy of $str # trim(@list); # trims @list inplace # @new = trim(@list); # trims (and returns) a copy of @list ################################################################################# sub trim { }