in reply to Checking for Number or String

Scalar::Util's looks_like_number tells the difference between what's a number and what's not (according to Perl's definition).
use Scalar::Util qw( looks_like_number ); die("Invalid amount of Gil \"$gil\"\n") if !looks_like_number($gil); die("Invalid character name \"$char\". " ."It must only contain letters [a-z])\n") if $char !~ /^[a-zA-Z]+\z/;

Replies are listed 'Best First'.
Re^2: Checking for Number or String
by Lennent (Initiate) on Nov 15, 2009 at 23:28 UTC
    Thanks a lot, Scalar::Util will come in very handy!