> #!/usr/bin/perl
> 
> +
> use warnings;
> use strict;
> use File::Find;
> 
> find sub {
>     return unless -f;
>     return unless $_ =~ /.\d+$/;
>     print "$_\n";
>     #print "$File::Find::name\n";
> 
> +
>         open(SD, "$_") or die "can't open $_ $!\n";
>         #my $fh = IO::File->new("> /tmp/savedata/new/$_") or die "Coul
> +dn't open new for writing: $! \n";
>         open(MY, "> /tmp/savedata/new/$_") or die "can't open new $_ $
> +!\n";

Why are you repeatedly opening and closing the file within the "find"
subroutine? You're overwriting the file every time by opening with ">"
and not ">>". Either place your open outside the find, or use append
mode.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to