You have an unnecessary set of parentheses where you declare your sub, assuming you didn't mean to set an invalid prototype, you should use code tags around code as otherwise the array indices are linkified and indentation is lost.
#! /usr/bin/perl
use strict;
use warnings;
my $hash_ref= parse_pdb("pdb.txt");
use Data::Dumper;
print Dumper($hash_ref);
sub parse_pdb{
my $file = shift;
my %hash_pdb = ();
my %val_seen=();
# Opening of PDB file after dowloading
open(FH, $file);
my @atomrecord = <FH>;
for my $record (@atomrecord){
chomp($record);
if($record =~/^ATOM/) {
my $con_key = "";
$con_key = "$temp[3]"." "."$temp[4]";
my $count = 0;
if( $hash_pdb{$con_key} ) {
if($val_seen{$temp[5]}) { }
else {
$hash_pdb{$con_key} = $hash_pdb{$con_key}."\t"."$t
+emp[5]";
}
}
else {
$hash_pdb{$con_key} = $temp[5];
}
$val_seen{$temp[5]} = 1;
}
if($record =~ /^ENDMDL/){
print "i am going out of loop\n";
last;
}
}
return \%hash_pdb;
}
running this gives you
$VAR1 = {
'PRO A' => '6',
'TRP A' => '7'
};
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."