in reply to passing Dumper output to print subroutine?
Perhaps I misunderstand you:
perl -le 'use Data::Dumper; open(my $fh, ">x.txt") or die "open $!"; p +rint $fh Dumper([1,2,3]);' [download]