Continue from diotalevi's reply, you can actually just open it as if you are opening a normal file:
use warnings; use strict; my $str; open FILE, ">", \$str; print FILE "abcd\n"; print FILE "1234\n"; print $str;#the content is there before close close FILE; print $str; #the content is still there after close
Update - Just to add a more complete example with Net::Telnet:
You have to use your real host name, user name and password to make it work.
use Net::Telnet; use warnings; use strict; my ($file, $str); open $file, ">", \$str; my $t = new Net::Telnet(timeout => 10, input_log => $file, Prompt => " +/\[AAUA1\]/"); $t->open("foo"); $t->login("me", "hi"); $t->cmd("pwd"); $t->cmd("whoami"); $t->close(); print "\$str content:\n"; print $str;
In reply to Re: Virtual Filehandles..
by pg
in thread Virtual Filehandles..
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |