That's the same as writing
$sid = "<%delete hard disk%>";
print "session id is $sid \n";
Perl is not ASP.
Look at $ENV{HTTP_COOKIE} to see if it contains a value.
Your ".pl" script runs in a cgi context, and is unaware of the ASP "session".
You need to realize that you CAN write an asp page in perl. This is called "perlscript". This has full access to all $Session variables. Please research this in the perl docs.