Hi

I'm writing a script that will connect to an ftp server (Redhat mirror), and download new versions of all packages that are on my machine. First of all, the script collects information about all the packages installed on my machine in an array (installed_packages). Then its goes on to get a list of all packages in a direcory on the ftp server and store it in an array (@remote_packages).

The next step is for me to select those packages from @remote_packages if found in @installed_packages and newer that the one in @installed_packages.

for instance:

@remote_packages = qw(perl-5.8.0-88.3.i386.rpm samba-2.2.7-5.7.0.i386.rpm);
@installed_packages = qw(perl-5.8.0-80.3.i386.rpm samba-2.2.7-5.8.0.i386.rpm);


In this example, the remote package perl is newer, so it should be stored in a third array; to be download. The below isn't complete, and I'm not sure of how to get the pattern matching correctly.


==========================================


sub select_newer {
    my (@remote_packages, @installed_packages);
    (@remote_packages, @installed_packages) = @_;
    foreach (@installed_packages){
         my $i = grep {$_} @remote_packages && ;
}

I'll appreciate any help

Babs


-- 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