This is a fairly commonly asked question. In the future, please search the monastery before posting. Typing "capture program output" into the search box came up with multiple answers right off the top.
Anyways, here is one node about it. PerlFAQ also has an answer to this one, here.
perl -e 'print "I love $^X$\"$]!$/"#$&V"+@( NO CARRIER'
In reply to Re: Capturing the output of another program
by Chmrr
in thread Capturing the output of another program
by dooberwah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |