Read the comments below
I am not going to change the logic of your code, just tweak your code ( Below is your code , smaller size )
#! /usr/local/bin/perl
my ($GNDpointer,$POWERpointer) = (0,0) ;
my $file = '' ;
# Check if argument is there , if it is then assume its file...