Hello all, I have a problem matching a pattern in an array. I go an ftp site and download a listing of the directory. If the directory contains a string (The string happens to be x86.exe) then I write that to a file. The entries of the file contain along the lines of /path/to/remote/directory/0613x86.exe I want to compare the MM/DD with a local file and if the file on the ftp site is newer, then download it. Thanks for your help, here is my code so far.
#!/usr/local/bin/perl -w use Net::FTP; #use strict; $host = 'www.ftp.com'; $user = 'anonymous'; $pass = 'updatepuller@somewhere.com'; $remote_dir = '/path/to/remote/directory'; $oldfilename = `ls current-sig`; chomp $oldfilename; $destination_dir= "current-sig"; $ftp = Net::FTP->new($host, Debug => 1); $ftp->login($user,$pass); my @listing = $ftp->ls("$remote_dir"); for (@listing) { if ( /x86.exe/i ) { open(FH, ">> myfile.txt") || die "Can't open $file for write: $!"; print FH "$_\n" } } close FH; open FH, "myfile.txt" or die "Couldn't open: $!"; while (<FH>) { @test = print "$_" } close FH; #$ftp->get("$remote_dir/$filename","$destination_dir/$filename"); $ftp->pasv(); $ftp->quit;

In reply to Pattern matching question by linebacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.