jalebie has asked for the wisdom of the Perl Monks concerning the following question:
sub reset ($@) { my $dir = shift @_; my @nums = @_; opendir (DIRHANDLE, $dir) or die "cannot open directory $dir \n"; my @files = readdir (DIRHANDLE); close DIRHANDLE; my $file; foreach $file (@files) { #print "$dir/$file \n"; if (-d "$dir/$file" && $file ne "." && $file ne "..") { &reset("$dir/$file",@nums); } elsif ($file eq "allstar_header.db") { print "$dir/$file \n"; open (FILEHANDLE, "+<$dir/$file") or die "Can't open $dir/ +$file \n"; while (<FILEHANDLE>) { if ($_ =~ /\s*solver_version_major_h.*/) { print $_; s/\d+/$nums[0]/; print "\t $_"; } if ($_ =~ /\s*solver_version_minor_h.*/) { print $_; s/\d+/$nums[1]/; print "\t $_"; } if ($_ =~ /\s*solver_version_fix_h.*/) { print $_; s/\d+/$nums[1]/; print "\t $_"; } } close FILEHANDLE; } } return 0; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: update a file
by tachyon (Chancellor) on Sep 26, 2001 at 20:25 UTC | |
|
Re: update a file
by davorg (Chancellor) on Sep 26, 2001 at 20:06 UTC | |
|
Re: update a file
by converter (Priest) on Sep 26, 2001 at 20:06 UTC | |
|
Re: update a file
by Anarion (Hermit) on Sep 26, 2001 at 20:12 UTC | |
|
Re: update a file
by RayRay459 (Pilgrim) on Sep 26, 2001 at 20:19 UTC |