in reply to Open/Save

You can open a file for output as:
open OUT, ">output.txt" or die "Can't open file\n"; print OUT foo close OUT
and you can read as:
open IN, "output" or die "Can't open file\n"; while(<IN>) { # do something with $_ } close IN;
Don't know if this is exactly what you want.

Alberto Simões

Replies are listed 'Best First'.
Re^2: Open/Save
by Anonymous Monk on Mar 31, 2005 at 14:49 UTC
    You forgot semicolons after some statements. Anyway, in modern Perl it's written like that:
    { open my $fh, '>', 'filename.ext'; print $fh 'foo'; close $fh; }; { open my $fh, '<', 'filename.ext'; while (<$fh>) { # $_ }; close $fh; };