my $input1 = "This is my sentence";
my $input2 = "This is my second sentence";
sub clean_input {
my ( $input ) = @_;
@input =~ s/\s+/_/g;
return $input;
}
sub my_weird_print {
my ( $input, $more_input ) = @_;
if ( ! $input ) {
print "\n";
}
elseif ( ! $more_input ) {
print clean_input ( $input );
}
else {
print clean_input("$input $more_input okie?" );
}
}
my_weird_print($input1, "is that"):
my_weird_print();
my_weird_print($input2);