in reply to Using Strings as File Handlers

There is another way, albeit not as good as Corion's. See: perlfaq5. Try this:
#!/usr/bin/perl use strict; use warnings; my $string = 'my-test-string'; open(my $fh, '>', \$string) or die "Could not open string for writing"; print $fh "my-test-string\n"; open($fh, '<', \$string) or die "Could not open string for reading"; my $x = <$fh>; print $x, "\n";

Replies are listed 'Best First'.
Re^2: Using Strings as File Handlers
by Corion (Patriarch) on Jan 04, 2010 at 09:20 UTC

    Oh - that is a different interpretation of the question, but it might well be that I misunderstood the question. This solution will use a string instead of a file on disk and access it as a file handle.