in reply to how to get value of print command

You're capturing the return value of the print command. If you simply want to assign a string to a variable:

my $result = "hello world";

Update: Please don't remove a question once you've posted it.