diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-21 16:56:10 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-21 16:56:10 +0000 |
| commit | c67ed39bc994a0aef06454c1e3044e79f712b739 (patch) | |
| tree | 4397f736b9161f50cd0b00cdcfd2b0acc7c1af7e /scripts/modules/file.pm | |
| parent | 93ce2024a62325cbae5f2f6fd2155a4ef89cee63 (diff) | |
Diffstat (limited to 'scripts/modules/file.pm')
| -rw-r--r-- | scripts/modules/file.pm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/modules/file.pm b/scripts/modules/file.pm new file mode 100644 index 0000000..b11e2b3 --- /dev/null +++ b/scripts/modules/file.pm @@ -0,0 +1,28 @@ +sub dopen +{ + my $shift = shift; + opendir DIR, $shift or die "$shift: $!\n"; + my @dir = readdir(DIR); + closedir DIR; + return @dir; +} + +sub fopen +{ + my $shift = shift; + open FILE, $shift or die "$shift: $!\n"; + my @file = <FILE>; + close FILE; + return @file; +} + +sub fwrite +{ + my $shift = shift; + my @file = @_; + open FILE, ">$shift" or die "$shift: $!\n"; + print FILE @file; + close FILE; +} + +1; |
