while ($in{$modContactTitle} =~ /[\s]+$/) { chop($in{$modContactTitle}); } #### $in{$modContactTitle} =~ s/[\s]+$//;
# yes the '[]' aren't necessary, but are helpful ##
## [0-9] #### and are you sure you want '1' and not $[ in: @array = (split " ", $sites); print $array[1]; if ($array[1] == 7) { ...