in reply to Simulate file

IO::String will let you do in-memory, in-core file operations, a "simulated file":
#!/usr/bin/perl use strict; use warnings; use IO::String; my $str = <<EOT; Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. EOT my $io = IO::String->new($str); $io->open('STDOUT'); my @lines = <$io>; $io->getline; my $buf = ""; read($io, $buf, 100); select $io; print STDOUT "$str\n"; $io->close('STDOUT');