you can use perlfunc:sprintf to convert strings to
numbers on the fly:
my $session_id = sprintf "%d", $string;
perhaps you could look at Apache::Session or
use an autoincrement field (if under MySQL) to handle
sessioning for you?
Or use a high-end webapp framework like
HTML::Embperl which handles sessioning for you
in a completely transparent manner.