sub strip_space { s/\s//g for @_; 1; } my $test = "this will have no spaces!"; strip_space($test); print $test,$/; __END__ thiswillhavenospaces!