Hi all, I using the code below that uses the Getopt::Std to process the
arguments from the command line (init subroutine).  However, for some
reason I do not get the  arguments from the switches. If anyone sees
what is the mistake I will be happy to hear about it. 

#!/usr/sbin/perl -w
use Getopt::Std;

&init;

open(F, "$FILE") || die  "I could not open $FILE\n";
while(<F>){
        if (! /ATOM/) {
                print $_;
        }
        else{
                if ( substr($_, $21,1) =~ $A ){
                        substr ($_, $21, 1, $B);
                        print $_;
                }
                else{
                        print $_;
                }
        }
}
close(F);

sub usage {
    my $program = `basename $0`;
    chop($program);
    print STDERR "
      $program [-p pdb ] [-a <chain_to_rename> ] [-b <new_chain_name>] [
-h ]

      Rename chain id from pdb

      -p         : pdb file
      -a         : chain to rename
      -b         : new chain name

 
";

}
sub init {
    getopts('pab');
    if ($opt_p) {
        $FILE = $opt_p;
        print "$FILE\n";
    } else {
        &usage;
        exit;
    }
    if ($opt_a) {
        $A = $opt_a;
        chomp($A);
    } 
    else {
        &usage;
        exit;
    }
    if ($opt_b) {
        $B = $opt_b;
        chomp($B);
    } 
    else {
        &usage;
        exit;
    }
}

-- 
*******************************************************************
PEDRO A. RECHE , pHD                TL: 617 632 3824
Bioinformatics Research Scientist   FX: 617 632 4569
Dana-Farber Cancer Institute,       EM: [EMAIL PROTECTED]
Molecular Immunology Foundation,    EM: [EMAIL PROTECTED]
Harvard Medical School,             W3: http://www.mifoundation.org 
44 Binney Street, D1510A,
Boston, MA 02115                                                
*******************************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to