You are getting an uninitialized error because you are trying to change the content of
$access_num, to which you've assigned
$1, but there were no parentheses in your first regular expression. Maybe you mean something like:
if ($line =~ s/^\s*ACCESSION\s*NUMBER:\s*/) {
$line =~ tr/-//;
}
or possibly
if ($line =~ s/^\s*ACCESSION\s*NUMBER:\s*([-\d]+)$/m) {
$access_num = $1;
$access_num =~ tr/-//;
}
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.