sub hello { my $hello_msg = shift; print $hello_msg; } # ... $hello="hello123"; hello($hello); # or just: # hello("hello123");