All,

I am wanting to improve my code b/c I am making 3 identical system calls.
So I thought a subroutine with that one call and LABELS for each condition
would improve it.
Is this possible b/c I am getting errors stating cannot find FPR.
                                                                            
                                                                            
 sub finger                                                                 
 {                                                                          
                                                                            
 open (GPG, "gpg --fingerprint |") or die "unable to open pipe sys call     
 + (1)... Broken? $!";                                                      
                                                                            
 for (;<GPG>;)                                                              
 {                                                                          
   EXP: if ( /(?i)expires/ )                                                
    {                                                                       
        y<-]>//d;                                                           
        $expdate = +(split)[4];                                             
        print $expdate,"\n";                                                
    }                                                                       
                                                                            
    FPR: if (/talx/ig .. /expire/ig)                                        
    {                                                                       
             if (/key/i)                                                    
             {                                                              
                y<[Key,fingerprint,=]>//d;                                  
                y{ }//d; print FPR $_;                                      
                print "Now deleting key\n";                                 
                # call;                                                     
                last;                                                       
              }                                                             
    }                                                                       
                                                                            
    KEY: if ( /(?i)pub/ and /(?i)talx/)                                     
    {                                                                       
          $keyid = (substr ($_,11,9));                                      
    }                                                                       
                                                                            
 }  # END FOR LOOP                                                          
                                                                            
 close (GPG) or die "unable to close pipe sys call (0)... Broken? $!";      
                                                                            
 }  # END ROUTINE                                                           
                                                                            
 &finger(goto EXP);                                                         
                                                                            
                                                                            
                                                                            
                                                                            




Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145


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