Previous

Next


33. Return to the Perl Example

  • Remember the example in Perl from the very start?
      #!/usr/bin/perl
    
      undef $/;
    
      require 5;
      use File::Find;
      use File::Copy;
    
      find(\&createList, "@ARGV[0]");
    
      ##############################################
    
      sub createList {
        $email = "";
        open(FILE, $_);
          $data = <FILE>;
        close(FILE);
        if ($data =~ m/User_email\s*=\s*([^\s]*)/) {
          $email = $1;
          if ($email =~ m/\w*\@\w*/) {
            print "$email\n";
          }
        }
      }
          
  • Well, we should be able to understand what it does now! Let's take a look...

Previous

Next

Andrew Hill

For LinuxSA Meeting, 21 November 2000