Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Read from temp file

by Thelonius (Priest)
on Sep 03, 2008 at 21:44 UTC ( #708865=note: print w/replies, xml ) Need Help??

in reply to Read from temp file

use File::Temp; use strict; my $fh = File::Temp->new(SUFFIX=>'.txt') or die "File::Temp: $!\n"; # $fh is a file handle. You can use it like this print $fh "This is a test\n"; # or as an object $fh->print("This is a only a test\n"); $fh->write("Testing 1,2,3\n"); # You can rewind and read it seek $fh, 0, 0 or die "Seek $fh failed: $!\n"; while (<$fh>) { print "Guess what I read: $_"; } # You can also use it as a filename to open it open ANOTHERFH, "<", $fh or die "Cannot open $fh: $!\n"; while (<ANOTHERFH>) { print "ANOTHERFH: $_"; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://708865]
[Corion]: Hmm - I think I'm not really making friends at $work. "We" (as in $current_project) should enter some Changes into the system, and I just told the Transition Manager, who should do that or tell somebody to do that to learn the system in which they ...
[Corion]: ... should create that Change.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2017-10-23 12:05 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (279 votes). Check out past polls.