Hi Thomas,

On Mon, 30 Jul 2012 20:23:58 +0800
Thomas Dean <tomdean...@gmail.com> wrote:

> Hi there,
> 
> I'm wondering how to get the file handle or a reference of a file
> object of a scalar in which stores a string.
> 

Starting from relatively recent versions of Perl, you can simply do:

use autodie;

my $buffer = "Hello World\nGood morning\nPretty foo\n";
open my $fh_to_string, '<', \$buffer;

And then do <$fh_to_string> and other operations. Otherwise, see:

* https://metacpan.org/module/IO::String

* https://metacpan.org/release/IO-stringy - seems unmaintained.

Regards,

        Shlomi Fish

> Thanks,
> Thomas
> 



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Original Riddles - http://www.shlomifish.org/puzzles/

Chuck Norris read the entire English Wikipedia in 24 hours. Twice.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to