in reply to Re^2: Could I get some feedback on my code please?
in thread Could I get some feedback on my code please?

About the file handle thing: in Perl 5 a file handle can be stored as a reference in a scalar variable. As of Perl 5.6 (I think), the builtin open function can initialize this variable for you:
open my $tokenfile, '<', $filename or die "Couldn't open file: $!";
Now $tokenfile is your filehandle and you don't have to worry about it being global or whatever. Have a read through perlopentut - it talks more about this.