Open for Reading and Writing
#Symbol Open For
#+< Read first, then write
#+> Write first, then read
#+>> Append first, then read
open(FH, "+<visitor_count") ||die "Can't open visitor_count: $!\n";
$count=<FH>;
print "You are visitor number $count.";
$count++;
seek(FH, 0,0) || die;
print FH $count;
close(FH);
Related examples in the same category