in reply to Writing to a New File
#!/usr/bin/env perl use warnings; use strict; my $file = './flashcount.txt'; open my $fh, '<', $file or die "Can not open file $file: !$\n"; my $count = <$fh>; close $fh or die "Can not close file $file: !$\n"; chomp $count; my $outcome = $count + 1; print "outcome = $outcome\n";
prints (Update):
outcome = 6
Another update: added chomp.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing to a New File
by SillyMonk (Initiate) on Jan 28, 2008 at 20:20 UTC |