my $variable = "HELLO world\nhow are you?\n"; open(my $fh, '<', \$variable); print $_ for (<$fh>); #### HELLO world how are you?