I'm not sure why that's not working. Here's a sample from a script which does work:
my $SwitchIP = '192.168.0.1';
my $password = 'seekrit';
my $t = new Net::Telnet::Cisco (Timeout => 10,
Dump_log => 'dump.log',
Input_log => 'input.log',
Port => 2011,
$t->login(Password => $password);
Hope that helps.
Update: I think see why your script isn't working. According to the Net::Telnet::Cisco docs, you need to issue a login command:
my $session = Net::Telnet::Cisco->new(Host => '18.104.22.168');
Your script seems to be correctly setting up the session, but you're issuing commands before you've logged into the router.
If things get any worse, I'll have to ask you to stop helping me.