in reply to perl typecasting

You could try using a regular expression:
#!/usr/bin/env perl use warnings; use strict; check_int('55'); check_int(0xff); check_int(123); check_int('#123'); check_int('$123'); sub check_int { my $num = shift; if ($num =~ /\D/) { print "Not an integer: $num\n"; } else { print "An integer: $num\n"; } }

prints out:

An integer: 55 An integer: 255 An integer: 123 Not an integer: #123 Not an integer: $123

Can you show some examples of integers with $ and #, along with some code that you've tried?