diff options
author | Francois Pons <fpons@mandriva.com> | 2000-11-14 15:31:59 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2000-11-14 15:31:59 +0000 |
commit | 949a885497d3d05e4dc0dc20e52ecb758d9b677c (patch) | |
tree | 0e7a20d9c3694bc4c392ea420607b7cbacdf3814 /perl-install/commands.pm | |
parent | 01975efac2cb7e05fbe05ec3733ae904669a1e94 (diff) | |
download | drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar.gz drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar.bz2 drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.tar.xz drakx-949a885497d3d05e4dc0dc20e52ecb758d9b677c.zip |
removed foreach (<... which are eating memory
Diffstat (limited to 'perl-install/commands.pm')
-rw-r--r-- | perl-install/commands.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/perl-install/commands.pm b/perl-install/commands.pm index f9b532958..e2d0f4c0d 100644 --- a/perl-install/commands.pm +++ b/perl-install/commands.pm @@ -261,7 +261,8 @@ sub cp { local (*F, *G); open F, $src or die "can't open $src for reading: $!\n"; open G, "> $dest" or $force or die "can't create $dest : $!\n"; - foreach (<F>) { print G $_ } + local $_; + while (<F>) { print G $_ } chmod mode($src), $dest; } } @@ -328,10 +329,11 @@ sub head_tail { $n = $n ? shift : 10; local *F; @_ ? open(F, $_[0]) || die "error: can't open file $_[0]\n" : (*F = *STDIN); + local $_; if ($0 eq 'head') { - foreach (<F>) { $n-- or return; print } + while (<F>) { $n-- or return; print } } else { - @_ = (); foreach (<F>) { push @_, $_; @_ > $n and shift; } + @_ = (); while (<F>) { push @_, $_; @_ > $n and shift; } print @_; } } |